If a particle moves along a path $\gamma : I\subset \mathbb{R}\to \mathbb{R}^3$ then the work done by a force $\mathbf{F}$ is defined by
$$W = \int_{\gamma} \mathbf{F} = \int_{I}\mathbf{F}(\gamma(t))\cdot \gamma'(t) dt.$$
If $\mathbf{F}$ happens to be the total force, then we can use Newton's second law to prove that
$$W = \Delta K,$$
with $K$ being the kinectic energy. All of this is all right, but the problem is that I'm taking a course on electrodynamics and the teacher said that the work $W_{\mathrm{ext}}$ done by one force external to the system is
$$W_{\mathrm{ext}} = \Delta K + \Delta U,$$
that is the change in the total energy of the system. I don't know where this comes from, indeed with that definition of work we would have simply $W = \Delta K$ for the total force, not one external force. So what is really going on here? What this formula means and how can it be derived?
EDIT: From Thermodynamics, I know that if we have a thermodynamical system with internal energy $E$ then by the first law $\Delta E = Q + W$. Now, if we were to consider $E$ the mechanical energy, that is $E = K + U$, if $Q = 0$ then we would get the formula. That is all nice, but I don't think this applies here. Why? Well, because I don't think a system of charges form a thermodynamic system. Indeed, a thermodynamic system usually refers to macroscopic matter, not point particles carrying a charge. More than that, Thermodynamics is meant to study equilibrium states of macroscopic matter, which we are certainly not doing, since although source charges are fixed, those feeling the field can (and will) move around. Is my reaoning right here?