Your dog might be bleeding from the penis and this condition can be due to urinary tract infection, kidney/bladder stones, prostate gland problems, clotting disorders etc. It will be better to get advice from the vet because treatment is different for different causes.