Minecraft wiki entry for Command_blocks_and_functions, associated text: This also deletes water, so the player basically becomes a moving sponge. To not remove water, use /execute as @p at @s run fill ~1 ~2 ~1 ~-1 ~0 ~-1 air keep water instead.
This works in any game mode.