If a gas expands in a container with constant external pressure then:
$W=-P_{ext}\Delta V$
Instead of $P_{ext}$ if we use $P_{int}$ then we will not get the same value because $P_{int}$ is constantly decreasing from a certain value until equilibrium is attained, while the change in volume remains the same.
This is the reason why we use $P_{ext}$ here:
$\Delta H= \Delta U +P_{ext} \Delta V$
But then, $\Delta H$ for a reaction is:
$\Delta H= \Delta U +\Delta n_{g}RT$ ($n_{g}$ is for change in number of gaseous moles as the solids and liquids are ignored)
where $PV=nRT$ is used. However, the $P$ in the ideal gas equation is $P_{int}$.
So my question is how can $P_{int}$ be substituted in the place of $P_{ext}$ if the values of work done change when we do so?