The magnitude of mechanical work or the P-V work is the force F, multiplied by the displacement dx through which the system boundary moved
[delta W=Fquad dx F=bar { P } cdot A delta W=bar { P } cdot Adx=bar { P } cdot dV]
(blacklozenge) Be careful! The pressure (bar { P }) here is the “resisting” pressure, NOT the system pressure P.
If your system is a gas with pressure P, and it expands against vacuum by volume ΔV, work done by the system is “ZERO” since the resisting pressure is zero