Thanks for trying that and getting back to us, katarina201. It's appreciated.
If the sound from your wireless headphones cuts out or is distorted - Apple Support -- Even though this article doesn't address issues when using a Bluetooth device with your Mac, the steps included can help.
To unpair your headphones from your Mac, go to Apple Menu > System Preferences > Bluetooth. Hover your mouse pointer over the headphones, then click the "X" to the right.
How to use safe mode on your Mac - Apple Support -- If they're still disconnecting, restart your Mac in safe mode and test the issue. You'll want to use the steps under "Apple silicon". Please refer to this before beginning: Graphics performance limited in macOS Recovery, safe mode, or Guest User mode - Apple Support
After you've had a chance to test the issue, restart your Mac normally to exit safe mode.
If your headphones stayed connected while in safe mode, see if they'll stay connected now.
Please let us know the results when you're able by replying to this post.
All the best.