While chemists are typically interested in changes in enthalpy there are times in which we would like to look at the change in internal energy instead. Most of the time these two are essentially equal. This is because most chemical changes involve minimal energy transfer in the form of work. This is not the case for chemical reactions that involve gas molecules where there is often a change in the volume at constant pressure.
To relate \(\Delta H\) and \(\Delta U\) for such reactions we need to think about the heat and the work at constant pressure.
\[\Delta U = q + w\]
That is the first law of thermodynamics. At constant pressure \(q = \Delta H\) and \(w = -P\Delta V\). Taking these two we see that
\[\Delta U = \Delta H - P\Delta V\]
If we are looking at a reaction at constant temperature and constant pressure, the only way the volume can change is if we have a change in the number of gas moles (assuming we have ideal gases). Thus we can rewrite the work term as
\[w = -P\Delta V = -\Delta n_{gas}RT\]
So the work can be found from the change in the number of moles of gas, \(\Delta n_{gas} = n_{\rm{gas\; final}}- n_{\rm{gas \;initial}}\). In these cases, we assume any volume change from solids or liquids is essentially zero since it will be much smaller than any volume changes for the gas. Using these assumptions if there is no change in the number of moles of gas, then \(\Delta H = \Delta U\).