Internal energy U is the total of the random kinetic and potential energies of all the molecules of a system, not heat.
U = Σ (KE + PE) of moleculesRaising the temperature raises the mean random KE, and so the internal energy.
U ∝ T (ideal gas, T in K)An expanding gas pushes its boundary. At constant pressure it does work as it moves a piston through a volume change.
Energy conservation for a gas: the change in internal energy equals heat supplied plus work done on the gas.
ΔU = q + W