Draw a boundary around the system. Heat is energy transferred because of a temperature difference; work is another way energy crosses the boundary. In the chemistry sign convention, heat entering and work done on the system count positive. At constant pressure, heat equals the enthalpy change when pressure–volume work is the only work.
A gas takes in 80 J of heat and does 30 J of work. What happens to its internal energy?
It rises by 50 J: +80 J in as heat and −30 J because work leaves the system.