Porch wants to leave home

Trying to figure what is going on here, both front and rear porches are moving away from the house. 1983 build. Homeowner filled gap with the crappy foam spray which is not doing a good job of protection.
Any suggestions on a simple method to return the porches next to the house, and are there any better than foam alternatives for this type of gap filling?

Porches may be resting on poured concrete, but the gap between the slab and house is less than 1" The front one should be fastened to the foundation, how it is usually done, resting on horizontal concrete beams cantilevered from foundation, but no longer possible to tell without removing the porch.

You mean those concrete steps? Mud Jack them or just make new ones.

Precast concrete steps, no proper foundation or compacted earth underneath them. Remove to one side, dig down two ft or so, fill with screenings and compact as you fill in 8 in lifts. Ensure drainage around exterior to down slope and replace steps.

Risers are uneven height as well.
Start over.

You could probably level them with a bobcat and a bucket of gravel