Giardia or another gastro-bacterial infection among other things. Whipworms. Something lodged or blocking the intestinal tract. All these are common causes of blood in the stool.
If the blood is bright red and looks like it's on the surface of the feces, it might just be that the dog ate something "sharp" and had trouble passing it. Provided it was nothing huge that was able to pass, the dog should be ok in a day or two.
If the dog is still passing blood in a day or so, make a vet appt and bring a recent fecal sample with you when you go. They will look at it under the microscope and should be able to see the bacteria if any are present.
If it's a bacterial infection, they usually prescribe metrodianzole (flagyl).