At the interface between the system and the surroundings, the pressure exerted by the system is exactly equal to the pressure exerted by the surroundings. That is, pressure is continuous at the interface. However, in an irreversible process (non-quasistatic), the pressure within the system will typically not be uniform spatially, so at other locations within the system, the pressure differs from the interface value. Therefore, we need to use the surroundings pressure (at the interface) to calculate the work, because that matches the system pressure at the location where work is being done (and this is the only pressure we may have access to). In addition to all that, in an irreversible process, the pressure within the system depends not only on the system volume (say using the ideal gas law), but also the rate of change of volume. This is because, with an irreversible change, viscous stresses contribute to the system pressure at the boundary. These stresses are not readily accounted for without performing a detailed transient gas dynamics analysis of the system. So, in the case of irreversible processes, we need to depend much more upon externally controlling the pressure imposed at the interface.