Pretty obvious that they are there to keep the water out.
They must also increase the width of the boat as it heels. This is done by making sure that the distance from the boast centre of gravity to the edge were the side comes up out of the water keeps getting bigger as the heeling angle is increased.
The top of the sides - on a canoe, must be low enough that the paddler, while sitting on the seat, or on the floor, does not bash his elbows.
Havent tried to paddle round something in a hurry with a thumped funny bone, and Im hoping to avoid it.