In most North American doors, the hinge is screwed to the door jamb with #10 1/2in screws, and the door jamb is screwed to the framing with #8 3in screws or nails. The hinge screws have an aesthetic finish matching the hinge. Your installation may vary by region, type of house built etc...
There is a space between the jamb and the framing to accommodate levelling the door. Often this is about 1/2in all around, but it could be zero at some spots or even as much as 1in.
Where the jamb is screwed to the frame there is a shim placed, to keep things tight and spaced properly for alignment.
The jamb is usually as wide as the frame plus the drywall on both sides of the wall. Therefore it's important to aim the framing screw correctly to make sure it properly penetrates the framing lumber and not the side of the drywall.
The jamb is usually screwed to the frame at or around the hinge. One or more of the hinge screws can be replaced by longer screws, the jamb screw can be hidden behind the hinge plate, or the screw head can be driven anywhere into the jamb and the head then covered by filler and paint.
You'd have to investigate why the short 1/2in screw de-attached from the jamb. It could be that the door was re-hung several times during installation, leaving a screw hole too large in diameter to hold the screw. The solution could be to fill the hole with perhaps a toothpick before re-inserting the screw.
The popping also suggests that the hinge is under tension meaning that the door is not hung correctly to begin with. The solution may be to remove all hinges except the top one by one screw, and to rehang the hinges without necessarily re-adjusting the jamb (that's a lot more work).
A longer hinge screw is not the solution, but it could work if it penetrates the framing. This does require proper shimming behind the hinge, otherwise tightening the screw will warp the jamb. If the shim is not there you'd have to remove the trim/casing and add shims where you intend to add screws.