Might be luck of the draw, but my experience with Android has been similar to OP. Each of my (at the time top of the line) Samsung phones stopped working due to various reasons after a time period ranging from just under an year, to a couple of years.
In comparison, my secondhand iPhone 3G worked for several years—until I left it in a plane by mistake. My iPhone 7plus I used for ~7 years; in fact I still use it, along with my new iPhone 13.