Heat and work in thermodynamics are not state variables. They are modes of energy transfer to a system resulting in change in its internal energy (U). U is a state variable as its value depends only on the given state of the system, not on its history i.e. not on the ‘path’ taken to arrive at that state.