It doesn't matter which tax return you prepare first, unless there is something in the 2022 tax return that carries over or otherwise affects the 2023 tax return. To play safe, if you're not sure, prepare the 2022 amended return before you finish your 2023 tax return, even if you don't file the amended return right away. At least you will have accurate figures for 2022 when you are finishing your 2023 return.
Actually filing the returns is separate from preparing them. It doesn't matter at all which one you file first. The IRS is going to take months to process the amended return - much longer than processing the 2023 return. So no matter which one you file first, the 2023 tax return will be processed long before the 2022 amended return. That's okay.
You will have to file the 2022 amended return by mail. You will probably e-file the 2023 tax return. But if you should happen to file 2023 by mail for any reason, do not mail the two returns together. You must mail them in separate envelopes.