Get your taxes done using TurboTax

you can only deduct $3,000 in net capital losses in any one year.  assuming the $500K is your net capital loss to date for 2022 taking an additional $500K in gains in 2022 you'll end up with no capital loss deduction and no carryover.

taking no further gains or losses in 2022 and taking $500K in long-term gains in 2023 you'll get a $3K capital loss (most likely short-term which is treated like ordinary income) deduction in 2022 with a $497K capital loss carryover. In 2023 you would have a $3K capital gain (most likely - long-term which may be federal tax-free). 

 

so there could be a slight advantage to taking the long-term gains in 2023 vs 2022 but this would depend on your income and what you do with your stocks in 2023.

 

another option is not to take the long-term gains. just continue to use up the short-term losses. note that any unused losses disappear upon your demise.