Assuming you can’t just deal with the pest problem because you don’t control what’s on the other side of the wall, I’d put in steel wool to keep rodents out, and spray foam this side of it to seal off the insects.
Home Depot sells a high-expanding foam that’s supposedly pest proof. The Great Stuff Pest Block is probably what you want.