Swimming Deterrence

How can I deter players from swimming in my datapack? I don't just mean sprint-swimming, but all kinds of traversing bodies of water. I want to do this to deter players from crossing rivers, forcing them to build bridges. I tried a slowness effect, but it doesn't seem to have any impact on swimming speed. I could add damage over time, but that is a little counter-intuitive and could feel unfair. Maybe I could make players "unable" to swim with some kind of sinking effect? But short of teleportation, I don't know how I would do that.
Continue to help post