Unfortunately, lack of practice equals regression in every skill including swimming. From playing an instrument like piano to swimming, to keep up your skills, you need to keep practising.
If you have had a long period of no swimming or stopped lessons or may be it’s been doing swimming lessons but, in on-and-off way, sadly regression is unavoidable. However, the level of regression depends on the swimmer and swimmer’s competency before you had stopped.
The more advanced and the better swimmer was pre-pandemic, the less impact of a long break. A long period of no swimming impacts advanced swimmers far less than those who were beginners. So, regression could be expected to be less in better swimmers compared to less competent ones. But, even good swimmers, they should expect to have lower stamina and less fit to swim long distances after a long period of not swimming.