Paraphimosis (tight foreskin trapped behind the corona) isn't fun, but it doesn't have to be an emergency if you know your anatomy and systematically resolve the condition. And with a little stretching it'll never happen again.
When the skin pops, or locks, in the sulcus (groove behind the head), just gently try to reduce the engorgement of the head by squeezing it from tip downward. If you can do that, the corona should reduce in size enough for your foreskin to slip forward again.
If the glans is too firm to do that, don't panic... just perform the same thing by squeezing blood downward through the veins from penis shaft top (not head) to shaft bottom. Your erection will subside and blood will naturally flow down out of the head, reducing its diameter. Your foreskin will return to normal.
Remember that the foreskin is a little like a male hymen. It's limited and not forgiving until it gets properly broken in, signaling readiness for full-out sex. Once you get to the point that your foreskin slides easily up and down during erection, you'll thank God and nature for designing us guys with a built-in turbo stimulator.