There are many ways in which you can do work on a system. You may compress a gas; you may magnetize some iron; you may charge a battery; you may stretch a wire, or twist it; you may stir a beaker of water.
Some of these processes are reversible; others are irreversible or dissipative. The work done in compressing a gas is reversible if it is quasistatic, and the internal and external pressures differ from each other always by only an infinitesimal amount. Charging a lead-acid car battery may be almost reversible; charging or discharging a flashlight battery is not, because it has a high internal resistance, and the chemical reactions are irreversible. Stretching or twisting a wire is reversible as long as you do not exceed the elastic limit. If you do exceed the elastic limit, it will not return to its original length; that is, it exhibits elastic hysteresis. When you magnetize a metal sample, you are doing work on it by rotating the little magnetic moments inside the metal. Is this reversible? To answer this, read about the phenomenon of magnetic hysteresis in Chapter 12, Section 12.6, of Electricity and Magnetism.
Work that is reversible is sometimes called configuration work. It is also sometimes called PdV work, because that is a common example. Work that is not reversible is sometimes called dissipative work. Forcing an electric current through a wire is clearly dissipative.
For much of the time, we shall be considering the work that is done on a system by compressing it. Solids and liquids require huge pressures to change their volumes significantly, so we shall often be considering a gas. We imagine, for example, that we have a quantity of gas held in a cylinder by a piston. The work done in compressing it in a reversible process is −PdV. If you are asking yourself "Is P the pressure that the gas is exerting on the piston, or the pressure that the piston is exerting on the gas?", remember that we are considering a reversible and quasistatic process, so that the difference between the two is at all stages infinitesimal. Remember also that in calculus, if x is some scalar quantity, the expression dx doesn't mean vaguely the "change" in x (an ill-defined word), but it means the increment or increase in x. Thus the symbol dV means the increase in volume, which is negative if we are doing work on the gas by compressing it. In any case whether you adopt the scientist convention or the engineer convention (try both) the first law, when applied to the compression or expansion of a gas, becomes
\[ d U=d Q-P d V.\]