Do you need W-2s or your tax returns from 2022 and 2023? A copy of your tax return will show all of your income for that year.
Or, you can get a transcript or copy of Form W-2, Wage and Tax Statement, from the IRS. See here.
An actual copy of your Form W-2 is only available if you submitted it with a paper tax return.
Also see IRS Topic 159
You can also pay $62 each for copies from the Social Security Administration. See SSA - w-2s.