Gaps between drywall and door casing
If no flex and not moisture damage, the classic method of repair is:

Find a drywall paste and use fiberglass-net type tape to reinforce it, directions are on the label. Use a 6” or 8” trowel and build up in layers after each one dries. Prime before painting. 

Fill large cracks with foam or butyl tape/strips/rope first, then cover with layers of drywall paste as above. You can embed the net tape to reinforce the repaire in the first layer.

If the cracks are around a door that moves or flexes the wall, use just the weatherstripping or cover with flexible caulk. Make sure it’s labeled paintable if you want to paint it.