With iOS 14, Apple released automatic source switching between different apple devices depending on which source emits audio. If I have spotify open on both devices, and try and play music on either one, spotify connect and the switching goes into a loop where the AirPods Pro bounce between devices. I can pause, but that doesn’t help. I have to quit spotify on one of the devices to fix it.
Thank you for your patience and for keeping in contact. Based on the reports and feedback we see along with tests we run on our end, this seems to be something on Apple's end and how the AirPods handle audio playback requests to Spotify automatically upon connection. To prevent this to happen, you can use the troubleshooting steps mentioned by @rdegroot_1995here. If anything else comes up, keep in mind that the Community will be here for you.
Just found a quick fix, disable "Devices lock screen" on your iPhone and iPad in the settings under devices. On iPhone/iPad > Settings > Devices > Disable: "Devices lock screen". As here https://mashtips.com/disable-spotify-connect/.
The AirPods switching function seems to send a 'play' message to Spotify on iPhone or iPad when switching devices, making Spotify witch the channel through Connect. Hope this helps.