The differential form of the first law takes the form $$dU=\delta Q + \delta W$$ or $$dU=TdS-pdV.$$ First, we know that $TdS=\delta Q$ for reversible process. So we can't say that $dU=\delta Q -pdV$. Assuming only $p$-$V$ work can we always say that $\delta W=-pdV$? Also in many textbooks when they calculate the work for a process they state that: $$W=-\int_i^fpdV$$ without stating if the process is reversible or not. I came up with this question when I read these notes Muddiest Points.
You cannot. The quantity $PdV$ only makes sense when you are talking of a reversible process, as irreversible process may not even have a relevant $P-V$ plot to talk about the quantity $PdV$.
This is because one can only draw a $P-V$ plot for states of equilibrium of a system. So, an irreversible process can have a $P-V$ plot consisting of just $2$ points - the initial and final state, as that is when the system is in equilibrium.
You require your system to be in equilibrium to be able to DEFINE quantities like pressure(how, for example, would you describe the pressure of a turbulent fluid-each point in it is at a different pressure!). By definition, then, the system is moving quasi-statically through these equilibrium steps. This is a reversible process.
The equations of state hold only for such reversible processes, for only then can these macroscopic parameters be uniquely specified. In your specific example, the idea is the gas is compressed by $dV$, working against the internal pressure($P(V,T)$), slowly enough(or, left for sufficient time) so that the compressed gas has attained equilibrium too, with the pressure now being $P(V-dV,T+dT)$. You then compress against THIS pressure. Clearly, the total work will become an integral of $P(V)dV$, as you keep doing this.