Dogs regulate their body temperature by panting. Unlike humans that can sweat to dissipate heat, dogs can only circulate cool air by panting to effect cooling. In most cases, panting is normal in dogs and it is usually seen during exercise, excitement, or in a hot environment. So it is normal for your dog to pant after a walk or any exercise. After each walk, ensure that your dog is kept in a cool place.
However, If your dog pants heavily after a walk even after resting the dog, that is abnormal. Heavy panting in your dog is expected to stop once the dog relaxes. Panting excessively hours after a walk should be investigated. Avoid walking dogs in the afternoon, rather walk your dog early in the morning or late in the evening. Furthermore, do not feed before a walk or immediately after. Feeding should be done after the dog has been rested. Close attention should be on snub-nosed breed like Pug, Boxer, and bulldogs during walk because they poorly manage heat.
There are other factors that could contribute to the heavy panting such as heart related medical condition, heat stroke, injury, poison, or snake bite. Excessive and prolonged panting of any course with signs like reddened gum, uncoordinated movement, drooling, diarrhea, loss of consciousness and collapse should be treated as an emergency and taken to the hospital immediately.