I was faced w/ this choice in summer of 2021. I really wanted an X, and the used pricing was finally coming to about the same price as a brand new Y at the time, but then Tesla raised the pricing on the Y. I shopped and waited, and got a '16 Model X P90D, private party. Drove it home from SE Florida.
Had some issues w/ supercharging speeds on my trip, so it went to the SC once I got it home to Minneapolis. HV pack needed to be replaced (under warranty, so no sweat). They had me in a 2021 Y for three weeks waiting on the replacement pack.
The Y is a nice vehicle, and I think it competes well in the price segment. It's nimble, seating is reasonably comfortable, etc. Ride quality is notably rough, having had a BMW X5 and Infiniti QX60 before going EV. The additional range and faster supercharging speeds are nice.
That being said, I'm glad I went w/ my X. It's far more comfortable overall: seating, ride quality is SIGNIFICANTLY smoother, I have more acceleration due to being the performance variant. I also have UHFS, so audio is great (though the Y actually might be a bit better). I am on AP1 and MCU1 (I actually prefer AP1 over current gen for highway driving). Do I wish I had more range and faster supercharging? Absolutely. Do I wish I had a landscape screen and MCU2? Yes.
Do I wish I had a Y? No. Between the enhanced comfort, ease of entry w/ the falcon doors, and FUSC + Lifetime Premium Connectivity, I'm pretty happy.
Up until pretty recently, I could have easily sold for at least what I paid for mine.
One thing to think about w/ the older X's is the current state of suspension. Budget in some $$$ for upkeep, as it's a heavy vehicle w/ a lot of power (even the non-P models). I recently had to sink about $5k into suspension work and tires given the age/mileage.