Can you check to ensure no debris is inside the headphone port @Nadine3 and when you insert them they are pushed up properly.
If the above is not relevant then a Samsung Experience Store or Samsung Service Centre location can help too via a diagnostic on it if required.
Current Phone > Samsung Z Fold³ 5G.
Its samsungs *****ty software. It happens to every single samsung phone that you've had for awhile. An update comes along and suddenly it stoppes working, regardless of wheter you are using wireless headphones or with cable.
I can confirm is a problem with the software, every time that the headphones stop working, i reboot the phone and then they work again, including the microphone of the headphones, but after I do 1 or 2 calls (phone or whatsapp) the right channel and the microphone of the headphones stop working.