I have had an iPhone 7 for many years; yes, same device. I don't remember the exact time when I got it, but it might've been around 2017. So this device is over 5, if not 6, years old. In all this time, I've had to replace only the screen due to physical damage, but the phone is otherwise perfectly functional. I've been told a few times that the battery needs replacement, but that's primarily because the phone reports battery's "Maximum Capacity" is 73%; but I'm reluctant to replace the battery because I haven't had any problems with the current battery.
Another data point: I bought an iPad Air 2 in November 2016 for my kids, and it's been used by my kids, changing hands as the older one grew out of it, and has had zero issues. Yes, it's screen has got scratches, and it's got blemishes on the body. But it's been running along just fine for over 7 years now. It's getting OS updates, even though it's been discontinued for over 5 years. I cannot say that for any of the Android devices I had bought, not even the ones made by Google.
Before getting the iPhone, I was firmly in the "android is best" camp, and I was almost against buying Apple devices, primarily for the cost of the hardware. I have bought phones, and a tablet, powered by Android, but none of them lasted long enough for me to extract value out of my investment. Either they died early because of some hardware failure, or because the device stopped getting updates.
After trying iPhone, and Apple's other hardware, like MacBooks, I have become a fan of the _quality_ of their products. Their products may not give the customer the same freedoms (of choice) and flexibilities that we've come to expect from Linux and Android worlds, but their products serve the needs of their customers for long durations, and in a way that no other company possesses the ability to do.
If you are of the type who pines for products of a bygone era where the products used to last decades, serving the customers faithfully without much fuss, I think you should seriously consider buying Apple devices.