After a big competition or tough practice, many swimmers don’t warm-down enough. They may swim until they feel “loose”, but in reality they probably need to go further. When worked to the max, the muscles need more time to recover and the lactic acid build-up needs more time to flush out of your system.
One good way to make sure you have warmed down enough is to continuously warm down until your heart rate is below a certain threshold. A good target would be around 80-90 bpm. At this point, your body is telling you that it has recovered and your cardio-vascular system has relaxed. Continue swimming (without stopping to chat with friends) until you hit that 80-90 bpm target. You may have to do a few more laps than your used to, but your body will be much happier and you will be more prepared for your next swim.