thank you to both of you ill get checked out asap.
Kidney stone is my guess.
Any type of bleeding from the penis should always be investigated by the medical profession.
Although the bleeding has now stopped, you still need to be examined. The pain when you urinate (pee) is connected. And the doctor is likely to check your urine for any bacterial infections.
It could be that you may have passed a kidney stone (these can be very small like a grain of sand) and this can cause pain and bleeding. As the same tube is used for your ejaculate and your urine it is possible that you may have had a little stone lodged.
I am sure that if your girlfriend was having an orgasm at the same time, it would not have hurt so badly that you then bled. I suggest until you are completely recovered that you keep off sex for the time being. Also drink plenty of water.
The doctor may also wish to examine your prostate.
Make an appointment to see your doctor urgently.
Hope you get on OK.
Let me know you get on.
Best wishes.