My pest control folks used to recommend stuffing steel wool into any cracks, but I know how flammable steel wool can be. Gap filler spray foam does not work well because its very easy for them to eat through it.
Online I found rolls of copper mesh for a rodent barrier that is supposed to work well to keep rodents out of small cracks and spaces. Its easy to insert when rolled up or crushed into a ball, and they can't eat through it.
Copper mesh stuffed into holes or a copper version of steel wool work very well to eliminate chew through. You can spray expanding foam into the mesh too in order to seal better and further thwart (keeps the copper wires in place while air-sealing). The combined impact is large. I do not usually see copper mesh/wool in stores, but you can easily order it online. The mesh is easy to work with and cut with scissors. I am not sure why the mice and rats do not chew through it since, in principle, they could easily do so. Fut they seem to dislike it enough not to try.
Generally speaking high attention to detail on seals is needed to prevent mice and rats from getting in. Low is most important, but for rats you may also need to worry about above the foundation and even roof. Also, make sure the interior is dry with no water sources. Availability of water (leaking pipes & fittings, ground seepage spots etc) can make the space much more inviting to mice and rats. I have a house that I rent in Cali that is in a field/wooded area on a hillside. If the crawl space below the house gets wet, it is near impossible to keep them from finding a way in (or making their own way). But if it is dry and penetration seals, vents, etc are rigorously maintained, it vastly decreases the issue. Always look for signs (droppings etc) if you think they got in and then seek out any potential issues. I try to keep it dry and sealed with a lot of poison bait traps (sorry, but have to do something and they do work) around the interior perimeter.
I would also add that if you are in a termite area keeping everything dry and vented along with well sealed keeps that nasty problem from occurring. Any water near wood is bad news. In Cali when they swarm to make new colonies, they are *everywhere* and they will find every and any opportunity for a new home ... in your home or wherever.