Your dog may have a parasite like worms or amoeba. Hemorrhoids. May have swallowed something that it is trying to pass that is damaging it's digestive tract. It may just be constipation issues. No matter what, you need to take the dog to the vet to find out and get it some relief.