If it switches automatically, “Moved to XXX” is displayed, and you can return the switched AirPods to the original device by tapping the “blue icon”.

Disable automatic AirPods switching

Make sure your AirPods Pro are connected from your device.

How to use AirPods

How to use iPhone