The gap between the door frame which is part of the door assembly and the studs are normal.
Filling door trim gaps. If the gap is small enough, you might be able to get away with simply filling it. Use the scraper to firmly press selleys no more cracks doors & trims in and scrape off any excess to. Next, measure the length of your door frame.
Place the straw on the foam can and spray. Applying trim on the wall will leave a gap between the trim piece and the door frame at least the thickness of the new sheetrock. You should use caulk to fill gaps or joints between trim pieces and/or drywall.
Now the door frames are too narrow. Seal the tube of remaining caulk with a waterproof wire nut, duct tape or a golf tee. Tack the stripping into place.
Make sure the surfaces are clean, dry and free of dust and loose or chalky paint. There are many places where you may need to fill gaps before you paint. After cutting the sweep to size, open the door and slide the sweep along the base.
I go through some options and then show a detaile. The first step to filling a gap between the window trim and the wall is to measure the thickness of the gap. Wait for caulk to dry.
Before using foam, try to make wet the wall and spray the foam. The space allows the door frame to be installed straight vertical. Start with the interior door side when using foam to fill large door trim gaps.