If your AirPods were submerged in water then you need to take quick action by trying to wipe them off with a micro-fiber towel or try the Water Eject Shortcut.
The iPhone does not have the Apple Watch's Water Lock feature, meaning there's no built-in way to eject water from an iPhone. That's where Apple's Shortcuts app comes in.
The aptly named Water Eject - Speaker Cleaner offers a combination of sounds and haptic patterns to help target harmful droplets sitting in your iPhone speakers.