I am trying to file for my 2022 and 2023 W2 I just had my son in 2023 can I still file for my 2022 along with 2023 and put my son as my dependent if he was born in 2023

Since my son wasn’t with me in 2022 I am confused on if I can still file that year with 2023 W2s and still put him as a dependent