Short answer
No. Only Apple Watch has a built-in water eject (Water Lock). On iPhone you need a water eject app like Clear Wave or a community Siri shortcut.
Apple Watch's Water Lock plays a series of tones to push water out of its speaker after swimming. iPhone has no equivalent setting, even though the physics is the same. The iPhone does warn you about liquid in the charging port on iPhone XS/XR and later, but that's detection, not ejection.
Your options on iPhone
- Water eject app — one tap, offline, with tests to confirm the result.
- Siri Shortcut — community-made, imported from a third-party site; can break after iOS updates.
- Web tone — needs internet and the screen kept on.