If you can still see land, you can probably swim back to it in case of an emergency.
Beyond simply swimming more, here's how to make sure you can always swim to safety.
1) Exhale Underwater
Start blowing air out as soon as your face is in the water. By emptying your lungs of carbon dioxide before taking a breath you free up lung space for oxygen and shorten the time each breath takes.
2) Breathe Better
Swimming only seems difficult because you can't breathe whenever you want. Develop a rhythm--every other stroke and every third stroke are common--that feels relaxed.
3) Sing to Yourself
It sounds ridiculous, but simple panic ("I can't breathe!") is what often sinks people, causing them to flail their arms to fatique. Play your favorite song on repeat in your head, and calm the hell down.