The first law is ΔU = q + w for a system. Heat entering the system is positive q; expansion against an external pressure is negative work because the system transfers energy to the surroundings. A temperature change alone does not identify the entire internal-energy change when work also occurs. Define the system and sign convention before adding energy terms.
For pressure-volume work, w = −PextΔV at constant external pressure. Expansion has ΔV > 0 and negative w; compression has ΔV < 0 and positive w. With Pext = 1.00 atm and expansion by 2.00 L, w = −2.00 L·atm = −203 J, using 1 L·atm = 101.325 J. If the gas also absorbs 300 J, ΔU = +300 − 203 = +97 J. “Does 203 J of work” reports a positive magnitude in words but contributes −203 J to this sign convention.
At constant volume with no other work, qv = ΔU. At constant pressure with only pressure-volume work, qp = ΔH. An adiabatic process has q = 0, but work can still change internal energy. Thus an expanding insulated gas can cool without losing heat. Heat and work are path dependent; ΔU and ΔH depend on endpoints.