Times have changed, no car will hold its value since there are new entrants with much better feature set. But, Toyota has a better resale value.
I own a Grande 2022 Black interior, replaced an Aqua for it, and previously owned a 2019 Grande biege interior, replaced it for 2.5 Sonata.
Toyota has really cut the cost on the new one and built quality is pathetic. I would personally advice you to go for Honda Civic, atleast the model is new. Though, the built quality of a Civic is also not really good.