Basic explanation….
The Heater Core, and A/C Evaporator are inside the same ”2 compartment box” on the firewall. All the air that enters the cabin goes through this box… There is a blend door in there that blocks off the air flow through the heater core (well it’s supposed to) so it only goes through the A/C Evaporator to cool the air. The blend door can break, or the seal can ”leak” allowing hot air into the cool air flow. Just remember, you have 190+ degree coolant running through the heater core whenever the engine is running, wither you are using the heat to not…. Cutting off coolant flow to the heater core, takes that heat load outta the “box” and allows the A/C to cool better, since it is not trying to cool the ambient air, it is also trying to take the heat out the heater core might introduce.
An example of this heating…. If you are running just the vent, (A/C not running) and you start off this way when the engine is cold. You can drive around and the air from the vents should be close to the same temp as ambient. But stop and shut the truck off and go inside (Once up to normal operating temp) and you come back out, and now the vent blows much warmer air that before you stopped. Reason is, the heater core with the hot coolant in it has now heated the box, and the vent is pulling that heat out while running….
Somce vehicles from the factory, I know the Ford Ranger was one, and I think my Excursion may also have one, is an vacuum activated valve that will cut off coolant when the A/C is switched to “MAX”…..