One of the ways is to construct dams across rivers that store water so it doesn't spill onto the adjacent land.
Another way is to construct levees, which are lateral walls along a river. The levees confine the rivers to the channels, so the river doesn't spill onto the adjacent land.
Another way is to build a sea wall, revetment, or bulkhead along the coast to keep excessive high tides from spilling onto the adjacent land. Salt marshes also serve to help reduce excessive high tides from spilling onto the adjacent lands.