How to stop hot air from engine compartment?

or the heater valve in the engine compartment is not closing and letting the hot water flow though the heater core

What year make and model?
I doubt you have firewall insulation. Maybe whatever is under the carpet, which isnt much.
May need to install Dynamat or something similar. It will keep the heat, and noise down.

Would I need to remove the dash too, or just stick to the carpet?