I've only had feature phones, but sometimes contemplate moving to a smart phone. At one point, the poor update policies for Android was a concern--but I've recently come to wonder if it really would make much difference. I can't imagine using a standard Android phone as anything more than a secondary device.
I remember hearing arguments that individual applications on computers might matter more than OS--although I'm sure this is highly debatable.
Both platforms have its pros and cons as they approach longevity from different perspective.
Apple iOS: everything is monolithic. All the major apps like Safari, Mail, and Messages (the common vectors for security issues) are updated alongside the OS updates. The cons is if your device is dropped off support, you won't get updates to these apps any longer. The Pros, so far Apple has an excellent track record in longevity, with the 6S running for 6 years of software support.
Android: Due to the nature of Android fragmentation, Google took several steps to compartmentalised Android in terms of updates. The way Android get updates depend on many companies.
First, there's the major OS update. Google Pixel and Samsung currently have the best track record, promising 3 years of OS updates (a far cry from Apple, but a high standard on Android). The rest of the OEMs are only doing it on best effort basis, usually maxing out at just one OS update.
Second: there's the monthly security patches. This allows Google to patch security issues to older Android versions. Problem is, the standard that Google put is quite low, only requiring OEMs to provide security patches on a quarterly basis for 2 years to get certifications. Obviously most OEMs simply do the bare minimum. Google and Samsung, again, hold the best standard, providing monthly patches to Pixel and flagship Galaxy phones (and few A models) for at least 3 years. The rest are quarterly (including most Samsung phones) or just biannually.
Third: there's the Google Play Security updates. This allows Google to patch some things and even distribute new features to older devices. Eg. Nearby share (Android's version of AirDrop) was pushed to devices as old as Android 6.
Fourth: compartmentalisation of apps. Chrome, Google Messages app, GMail, etc are all available on the Play Store and can be updated independently of the phone's firmware. So even if your phone is outdated, the individual apps can still be updated via the Play Store. More and more OEMs are distributing their apps this way as well (eg. Samsung Internet Browser is available in the Play Store).
Last but not least, custom ROM. Old Android devices can gain new life through custom ROM running the latest Android version. The catch is, hardware support and stability is variable as you're relying on the community to work out the bugs. Also, most secure apps like banking apps will not support rooted/custom ROM devices.
In the end, you pick a platform that fits your needs. If you replace your phone every year or two, this argument is moot as you can go either one and you are good. It's just personal preference. But if you want to keep your phone for longer than 3 years, iPhone is your choice imo. We will see how the Pixel 6 will do as one bottleneck for Android updates is actually Qualcomm itself, as they only provide driver support for their SoC for a few years (they just announced 3 years of support I think, that shows their low standard). Pixel 6 will use Google's custom SoC, hinting that Google will match Apple for 5 years of software support.
Personally, I have a Galaxy S21 as my main phone since it has features that iOS will never have (eg. twin apps, built-in call recording). But at the same time, I have an iPhone 7+ for my banking apps as Apple has a better track record in what user data are exposed to 3rd party apps.