The choice between stain removal and carpet replacement depends on the age of your carpet and how badly it was stained/damaged. If your carpet is fairly new and you just accidentally spilt something on it, you might be able to get away with professional cleaning. If your carpet is ten years or older and you find it's every nook and cranny disgusting, then the choice is obvious.
Regardless, professional carpet cleaners can tell you what the best solution might be. Pick a company that can inspect the damage for little to no cost and will tell you upfront if they can remove the stain or not. Some cleaners can revive an older carpet if it is well-maintained. I had used Acorn Carpet Cleaning in the past when I accidentally spilt wine over my carpet, and they did a great job! I highly recommend them to anyone who’s looking for affordable carpet cleaning in Glasgow.