If there is dust and other debris in and around the fan compartment then your filter is not doing it’s job. Sounds like there is no filter at all. Should not have foam in the fan compartment unless it came from something in the fan compartment itself.
Having the air come in from another area like cracks around the access do is not the end of the world but it is better to have them sealed up as you should be pulling most of your return air from the space you are trying to condition.
Turn off the power and vacuum that dust and debris out. Duct tape any other cracks or holes you can find. You should not need to duct tape the access door as most usually seal up OK, but if it is a problem then you can. It will just mean that the next time you want to remove it, you will have to remove the tape.