Listen to your body. If it hurts, let it rest and recover. And learn the difference between soreness that indicates a new movement or new level of effort versus pain that can indicate an injury or overuse.
If it "always hurts when you do that," look at ways to improve your form, technique, or schedule. (If "it always hurts when I run 2 days back to back," then take at least 1 full day [two sleeps] between runs.) Don't hesitate to get help on choosing adjustments.
Pain is an imprecise signal — it often indicates that something should change, but what that is and how it should change is not always obvious. If you are feeling it, take the time to investigate and resolve it.