If there is just a small amount of blood it could just be that your dog has been constipated and some blood is coming out with the poop. If there is more than a trace amount though you need to take your dog to the vet as soon as possible.
Please take a vet because the dog. Due to fungus formation only these rectum problems may arise. The dog should be given medicines which control the oozing of blood and have a through checkup with the rectum.
Take your dog to the vet, it could be something serious. The vet can tell you, if there is something seriously wrong with the dog. Always have that stuff checked out.