In my experience swimming lessons work best f you get to swim a lot, which in my childhood meant that most kids did a few years of lessons but mostly became swimmers by actually swimming in the summer, at lakes, rivers, or in the sea.
One thing I have noticed with my kids is that they get a lot less swimming time because the rules at supervised beaches are differernt now. When I was a kid, mums sat on the beach or shore and watched the kids. Now they expect the mums to be in the water with kids under 9. And will come and tell them that. So you see a lot fewer kids in the water.
I noticed this really clearly when looking at kids summer camps when I was travelling last summer. Where I live in Canada, the Boys and Girl's Club took their kids, and they all went in the water in a line. The camp leaders had to be farther out, they couln't go past them. So the kids were basically up to their knees and couldn't really swim. So they stayed in for 5 minutes and then went and played on the beach because it was no fun.
In contrast, when my daughter was visiting family in Bermuda, her summer camp took them to the beach, the leaders sat down on the sand to watch them, and the kids were in the water playing for hours, swimming, jumping off rocks. Those kids swam like fishes, and my daughter's swimming improved massively over the month.
Around here now, most people take their kids to splash pads in the heat, not to swim.