Probably they are competing for engineers, Messenger / WhatsApp vs iMessage, time spent on Facebook content vs on Apple content and other things I'm missing.
On the other side they benefitted from the popularity of Facebook (and many other internet properties companies) because they gave an extra reason to people to buy smartphones and using them a lot.
They're both huge companies whose largest risk of disruption comes not from the marketplace (they can monitor, acquire and influence challengers), but from regulators. The appearance of competition helps both companies to reduce that risk.
> Power cycle device.
'Apple Verification. Enter the password for "<email>" in Settings.'
> Tap 'Not Now'
'Apple Verification. Enter the password for "<email>" in Settings.'
> Tap 'Not Now'
'Apple Verification. Enter the password for "<email>" in Settings.'
> Tap 'Not Now'
'Apple Verification. Enter the password for "<email>" in Settings.'
> Tap 'Not Now'