Retirement tax questions

Thanks for your answer but I'm a little confused on the meaning of the 'P' code you're mentioning.

 

If I sell my 2020 ROTH IRA excess contributions and earnings now (in 2021), and then get a 1099-R in 2022 with the code 'P' mentioned on it, won't it mean it's for the 2021 tax return filing since I received it in 2022 ?

 

Also in what case would a 1099-R NOT have the code 'P' on it ?