I['m sure you already know this is probably blood. Rectal bleeding can be a problem in the rectum or the colon. If it happens right after defecating, it may be an anal gland problem. Just bleeding from the rectum without clots may just be a problem in the rectal area such as rectal polyps. You can read about anal gland problems here:
You can read about rectal polyps here:
It's also possible your dog may be experiencing a rectal prolapse. You can read about that here.
Parasites such as worms and protozoan infections such as coccidia and giardia can produce blood in the stool and blood from the rectum after bowel movements. Common dewormers are Panacur, which is a prescription product so you need to obtain it from your Vet and it works on roundworms and whipworms. Wormers labeled as Pyrantel Pamoate are the best over the counter medication for roundworms. Drontal plus is also a prescription product and is used for the treatment of Tapeworms, though dewormers with praziquantel work well against tapeworms. Revolution and Interceptor as well as other heartworm medications also control whipworms and roundworms. Another reason to keep your dog on Heartworm medication.
You can read about these here:
If there is straining to defecate, frequent small stools, mucus with the stools, blood coating the feces, signs of discomfort such as licking, turning suddently or crying, then most likely the problem is in the rectal area. This would include rectal polyps or prolapse, parassites, colitis, colonic ulcers, hemorrhagic gastoenteritis (HGE) and even cancer. HGE is very serious and life threatening. You can read about it here:
If the dog is vomiting and refusing to eat along with bloody diarrhea, then the dog should be seen immediately by your vet. Most cases of blood in the stool or bleeding from the rectum is not immediately life threatening if there is no bleeding from other openings, but there are a few that can be. You can read about the various cause of red blood in the stool here:
I do urge you to have the dog seen in any case so a definite diagnoses can be determined and treatment plan decided on. I hope this information is helpful to you.