Hi
It can be normal for the speaker to sound muffled after being exposed to water and for it to take some time until the speaker performs normally again.
Follow Apple's instructions for drying your iPhone, including:
To see whether any water is in the speaker or microphone:
- Place your iPhone, speaker side down, on a lint-free cloth and see whether water drips out.
- Water in the port might degrade speaker (or microphone) performance until it has completely evaporated.
To dry your iPhone:
- Wipe it off with a soft, lint-free cloth.
- Tap your iPhone gently against your hand with the Lightning connector facing down and remove excess liquid.
- Leave your iPhone in a dry area with some airflow.
- Placing it in front of a fan blowing cool air directly into the Lightning connector might help.
- Do not dry your iPhone using an external heat source or insert any foreign objects (eg cotton swabs, paper towels) into the Lightning connector.
More information:
About iPhone 7 and iPhone 7 Plus splash, water, and dust resistance - Apple Support