Dogs can actually swim pretty well when taught and can be trained to drag people effectively back to shore. It's called "doggy paddle" because that's what they're limited to doing given their natural mobility (and given the wider range of arm mobility in humans, it looks kind of silly for us to do it), but it's how they swim, and it works. The life jacket, obviously, helps. Golden retrievers in particular I think often really like the water, and retrievers are good for this job.
Retrievers in general were bred for swimming, because their main job was originally to fetch dead ducks out of lakes for hunters.
At the extreme end, Newfoundlands supposedly will sometimes jump into water and try to rescue people even without specific training. They were bred originally as work dogs for ocean fishermen, so they're very powerful swimmers.