Because the magnetic force on a moving charge is perpendicular to the velocity, the work done by a magnetic force is zero. However, in a multiparticle system it can happen that magnetic forces can rearrange the energy within the system, as long as these forces do as much negative work as they do positive work, so that the net work done is zero.
An interesting example of this is the case of a rotating wheel carrying point charges in a magnetic field. In the example shown below, there is a fixed, current-carrying coil on the left with a magnetic dipole moment pointing to the right. When you click Run, the wheel is given an initial spin so that it too has a magnetic dipole moment pointing to the right, and it is attracted toward the coil, sliding with negligible friction on a long rod. Now that it is moving to the left, it is easy to show that there are now magnetic forces that act tangentially on the point charges, thereby exerting a torque that slows down the rotation and eventually reduces the angular speed to zero and even makes the wheel spin in the opposite direction to the orginal spin direction. Now that the wheel’s magnetic dipole moment is to the left, the current-carrying coil repels the wheel, bringing the wheel momentarily to a stop and then pushing the wheel to the right. The torque on the wheel again reverses and restores the original spin direction, and the wheel is again attracted to the coil so that the translational motion decreases. The effect is to lead to an oscillation of the wheel, back and forth. (Right button drag or Ctrl-drag to rotate the “camera”; to zoom, drag with middle button or Alt/Option depressed, or use a scroll wheel; on a two-button mouse, middle is left + right. With a touch screen, pinch/extend to zoom, swipe or two-finger rotate.)
The graph that appears when you click Run shows the rotational kinetic energy of the wheel (red) which initially decreases as the translational kinetic energy (green) increases. The sum of the rotational and translational kinetic energies remains constant (the blue line), consistent with the fact that magnetic forces do zero net work on a system.
Another example of this is the case of a conducting bar sliding along conductive rails in the presence of a constant magnetic field perpendicular to the plane of the rails. With a resistor attached across the rails, it is necessary to exert a force on the bar to keep it moving at a constant speed, and a current runs in the resistor due to a “motional emf” of amount vBL, where v is the speed of the bar, B is the magnitude of the magnetic field, and L is the distance between the two rails. As the bar slides along, a mobile electron in the bar moves at an angle to a perpendicular to the rails, and when this path direction is taken into account one sees that the magnetic force on the moving electron has a component parallel to the rails which does negative work, opposing the force you apply, and a component perpendicular to the rails, which does positive work that heats the resistor. The total work done can be shown to be zero.