We won't know if iOS is more secure but there are certainly more in house security updates being pushed down by Apple. Security updates on Android are pushed by the manufacturer.
Security updates come from Google, then the manufacturers integrate it into their Android distributions and push it out to users (often via the carriers, who do their own testing).
All Pixels get updates directly from Google.
And I believe Android gets monthly security updates.
A Pixel/XL is comparable to an iPhone 8 or 8+ in the general sense. However, in the more specific/personal sense, it may not be depending on what other devices/content you own, or the apps/services you use on your phone.
If you have a ton of iBooks (and Audiobooks) and purchased iTunes Content (Movies, TV Shows), then this will be a problem because these things are only accessible on iOS smartphones. If you have Apple TV, iMac, and/or iPad... Then moving to Android can destroy workflows and integration...
If you're technology is already well-diversified, then this is not an issue - unless you are clinging onto certain services like iMessage.
The reverse is less of an issue, since Google services are well-supported on a variety of platforms (Roku has a Play Movies & TV App, for example), including iOS.
A trend that I've also noticed - in my social circle - is that iPhone users are more likely to buy iPhone-only apps than Android users; but that's anecdotal.
With cross-platform apps, I've been very successful at getting developers to give me a license for the other platform when I switched. This saves a lot of money, as many of the apps I use cost in the $5-15 range. You lose that option with platform-locked apps, which increases the effective cost of the device.