How to make the character stick to the surface of the water

I was playing my game in the editor but noticed that if the character comes out of the water and then again in water the character is going underwater.

I am trying to create a swimming system like Fortnite.