I've been struggling with a pair of misbehaving AirPods Pro for about a month now. Sometimes the left earpiece would play, sometimes the right, and every time I opened the case, iOS kept bugging me that these weren't my AirPods.
I tried every tip on the Internet and finally got it to work following these steps:
Step 1: make sure both earpieces are charged
This step might sound trivial, but if one of your earpieces' batteries is empty, it won't play any sound. Make sure the charging pins of your charging case are clean.
Sometimes these little pins like to play hide & seek. You can use tweezers to grab them and slightly move them. Be careful!
All is good when the little status light on your charging case blinks.
Step 2: forget your AirPods
Open your iPhone's settings, select Bluetooth, pick your AirPods and forget the device.
Step 3: completely shut down your iPhone
Press volume up and the side button to completely shut down your iPhone.
Step 4: factory reset your Airpods
Press the button on the back of your Airpods until the light flashes amber three times. Wait for about a minute for the reset to be completed.
While doing so, power on your iPhone.
Step 5: reboot your iPhone once more
I don't know if this step is necessary, but I did it, and my Airpods work now. Do a complete reboot of your iPhone by short tapping volume up, short tapping volume down, then holding the side button until the Apple logo appears.
Step 6: open the lid of your Airpods & pair them with your iPhone.
All should work now!