The transfer of heat is normally from a high temperature object to a lower temperature object. Heat transfer changes the internal energy of both systems involved according to the First Law of Thermodynamics.
First law of Thermodynamics
The first law of thermodynamics is the application of the conservation of energy principle to heat and thermodynamic processes:
The change in internal energy of a system is equal to the heat aded to the system plus work done on the system i.e.,

U = Q + W
The first law makes use of the key concepts of internal energy, heat, and system work. It is used extensively in the discussion of heat engines.
Sign convention is:
1) Work done on the system is taken as +ve
2) Work done by the system is taken as -ve
Hence in the context of physics, the common scenario is one of adding heat to a volume of gas and using the expansion of that gas to do work, as in the pushing down of a piston in an internal combustion engine. In the context of chemical reactions and process, it may be more common to deal with situations where work is done on the system rather than by it.