From my understanding, if you were to look at a pressure-volume graph of a reversible, isothermal expansion, the area under it would represent reversible work. Similarly, if you were to graph an irreversible, isothermal expansion on top of this graph, you’d see a smaller rectangular area representing the irreversible work.
What I have been told is that the area between these areas, irreversible and reversible, is wasted energy dissipated as heat. This confuses me, however. If the work the irreversible system does is less, then it should draw less heat from the surroundings (w=-q). So, if it still releases the same quantity of energy, just more of it as heat and less as work, then how would it maintain a constant internal energy? In other words, if the system dissipates the unused work as heat, which is not replenished, then how does it stay at constant T?