They are both great phones
I had the S22 Ultra and loved it.
I then upgraded to the S23 Ultra
The S23 Ultra has lots of small improvements that add up to make it that much better than the S22 Ultra
If you have the money, then go for the S23 Ultra, if you want to save quite a lot of money. Then the S22 Ultra is the way to go.
To be honest, both phones are great and you would be happy with either of them