I’m not good enough at this for actual advice, but my thoughts are:
If you are comfortably capable of paying cash for the new car, and plan to drive it until it dies, I’d do that.
You get the full warranty, depreciation doesn’t factor in since you won’t be selling it, and you know what you’re starting out with; a new car. If you take good care of it, hell, it could go for decades. I have a 1997 Ford Explorer that is now showing body rust, and needs minor repairs, but is still basically running strong.
Whereas, even a lightly-used newer car with a warranty remaining is a higher risk, just because you really don’t know where it’s been, or what it’s been through (i.e. did it tow a camper or boat a lot?). True, it’s a low risk, but I worry about stuff like that. When the warranty runs out, I’d start losing sleep.
And the older car you get, the higher the risk. Cars have so many things that can go wrong, even the most competent mechanic won’t be able to check absolutely everything, especially inside the engine. And transmissions can fail even more suddenly; working fine one day, non-functional the next. And the general fix for transmission failure is almost always to replace the entire transmission, which is almost as expensive as a new engine in some cases.
Just my two cents. And that assumes you’re able to pay cash.
If you need to get a loan, that would reformulate the entire thing, and my post would be moot.