Dipping - being penetrated or penetrating without ejaculation (cumming) - is a common practice. Herpes, gonorrhea, chlamydia and syphilis infections can all be transmitted without any cum present. HIV is found in pre-cum and could be transmitted even without full ejaculation. The risk of transmitting HIV without ejaculation is definitely lower than with ejaculation because there is less virus, but there is still some risk involved. It can also be hard to tell if your partner starts to cum before he pulls out.
PrEP is a great way to protect yourself from HIV if you're having anal sex without a
condom; and if a condom breaks,
PEP can be effective if started within 72 hours of the possible exposure.