One of the many advantages of Pixel phones is the fact that they're made by Google itself. The synergy of hardware and software ensures speedy Android updates and long support. The Pixel 4 and 4 XL are no different. Just like their predecessors, they'll get Android security updates for three years, until October 2022.
Many Android flagships can count themselves lucky to receive one major OS update. Pixel phones have much better longevity, and it's great to see Google remaining committed with the Pixel 4 and 4 XL. The first-gen Pixel even received an update to Android 10 outside its frame of guaranteed upgrades, so who knows, maybe we'll be able to say the same about the Pixel 4 in a couple of years.
Of course, some iPhones receive software updates for more than five years, but if you intend to use an up-to-date Android phone for a long time, Pixel devices should be a relatively safe bet.