Get a used Pixel and install either LineageOS, GraphenOS or CalyxOS. If you don't want a Pixel, LineageOS supports other devices so you can buy any of those models used as well. Apple, Samsung or whoever can't take us down!
wait until Google releases a new pixel this fall, buy "last year's" pixel at a discount and they are supported for 7 (?) years of updates (including firmware).
I would recommend GraphenesOS bc they only deal with android and pixel phones so there is a high level of compatibility and things rarely break. (In many cases GrapheneOS was more stable than Google's android, recently with the multiple profiles and memory bug). They also push fixes and security hardening upstream sometimes.
Anyway, GrapheneOS will support a Pixel for as long as the manufacturer (Google) releases firmware updates. So you have the potential of 7+ years of support from GrapheneOS.