Males can suffer from something called paraphimosis, where the penis comes out and does not retract back in. Depending on how long it is stuck out, the tissue of the penis can become dry and, in worst cases, can become necrotic from loss of blood supply to the tissue from being stuck out.

Since you're seeing blood, this may indicate that the tissue became too dry and went back in, causing irritation, or the tissue was out for too long and is starting to cause irritation or issues.

In either case, PLEASE consider a vet visit, ESPECIALLY if the penis is still stuck out.