Eating garbage can cause a bacterial infection in the digestive tract that may lead to bloody stools or excessive mucus in stool.
While your veterinarian will make an official diagnosis, it could be that your dog is experiencing food poisoning as a result of blood in stool or the mucus production.