Hello the_martsss,
Be sure to check for any available iOS updates on the iPhone, to help ensure the latest improvements are applied: Update your iPhone or iPad - Apple Support
It may also help to try testing the AirPods one at a time, to see if the issue may be caused by just one of them.
Restarting the iPhone can also help with odd behaviors that may come up: Restart your iPhone - Apple Support
Resetting the AirPods can also similarly help with issues that come up: How to reset your AirPods and AirPods Pro - Apple Support
1. Put your AirPods in their charging case, and close the lid.
2. Wait 30 seconds.
3. Open the lid of your charging case, and put your AirPods in your ears.
4. Go to Settings > Bluetooth. Or go to Settings > [your AirPods].
•If your AirPods appear there as connected, tap the More Info button
next to your AirPods, tap Forget This Device, then tap again to confirm.
•If your AirPods don't appear there, continue to the next step.
5. Put your AirPods in their charging case, and keep the lid open.
6. Press and hold the setup button on the back of the case for about 15 seconds, until the status light on the front of the case flashes amber, then white.*

7. Reconnect your AirPods: With your AirPods in their charging case and the lid open, place your AirPods close to your iPhone or iPad. Follow the steps on your device's screen.
AirPods can be associated with one Apple ID. If you want to use AirPods (3rd generation) or AirPods Pro (1st or 2nd generation) that someone else has used, they first need to remove the AirPods from their Apple ID.
Cheers.