Well...in the year you actually retire, you'd get both.
1) A W-2 for the time you worked in 2022
2)...then a 1099-R form for all the retirement $$ you receive after retiring.
___________
IF you were retired all of 2022, then it's rare, but possible to get a W-2 for some smaller amount if you retired right at the end of 2021...if the last pay period happened to slop into 2022.