Sorry to hear about your dog's issue. Blood from the penis can happen for really one of three reasons:
1. A penis issue- This may be something like penile trauma, a bit of foreign material caught between the penis and the prepuce (the skin that surrounds the penis), pr a prepucial infection. This is the less common cause of blood coming from the penis but is easily investigated by your vet.
2. A urinary issue- If the blood is dripping from the penis while he is urinating then it is likely a urinary issue like a bladder infection or bladder stones. Even if the blood is dripping independent of urination it could still be a possible stone issue and typically the course of action is to have your vet run a urine sample, looking for stones, crystals, bacteria, etc and they should collect this by passing a urinary cathether to ensure it passes easily up through the urethra (the tube through the penis where urine exits) as sometimes little bits f stone and grit get trapped here.
3. Prostate issue. Finally, the most common cause of blood dripping from the penis independently from urination is a prostate problem. There are several types of prostate issues including benign (non-cancerous) prostate hyperplasia (enlargement), prostatitis (inflammation in the prostate) and prostate cancer. In many of these cases blood will drip freely from the penis when the dog is not urinating and is non-painful. In all of these cases neutering the dog is needed to resolve this issue. If your dog is already neutered it can still be a prostate issue but it's very rare. An ultrasound is usually needed to confirm this issue in a neutered dog. In an unneutered dog your vet will want to run the urinalysis and will want to perform a rectal exam to check the prostate.
I hope all of this information was helpful and good luck with you dog.
I noticed that you have viewed my response. Was this information helpful or did you have more questions? If it was helpful please consider accepting my answer by clicking the green accept button so I may receive credit for helping you. If you have additional questions let me know so I can try to help you further.