Hello there amaia1493,
I understand you've noticed that your microphone doesn't work when you're connected to a bluetooth speaker, so let's see if the following information may be able to help with that.
In regards to using Bluetooth and your microphone at the same time, the device connected may be taking control for the iPhone to use a microphone that is built-in with the speaker. Are you aware if the device you're connected with may have a microphone that picks up your voice when you're nearby? If you're not certain, try that out to determine if that is what is occurring.
In addition to trying that, see if you're able to use Siri while connected to the device. For assistance with using Siri, check out the following information. When using Siri, see if it's able to hear what you state to determine if this is isolated to the device, iPhone, or app.
Ask Siri on iPhone
As for being unable to send voice messages, are you able to make a recording within Voice Memos? This will further help to isolate what may be causing this to happen to be able to turn your focus there. For assistance with testing this, be sure you're connected to the device then use the steps of this resource:
Make a recording in Voice Memos on iPhone
If you still haven't isolated what is causing this to occur, Contact Apple Support to look into this with you in more detail.
Cheers!