It seems that from time to time when removing a switch or outlet for replacement, the electrical box may be set too far back in the wall. Often times these devices are shimmed out with nuts, washers and other things to pull the device flush with the drywall face. If a device is set in the wall too deeply, the cover plate won't tighten down correctly and will likely crack. Likewise, some boxes stick out of the wall too far and the cover plate won't draw close enough to the drywall to touch.
Box extenders come in varying depths to allow the face of the box to become flush with the wall. Plastic box extenders fit right over the existing box and tighten down using the screws on the device. Depending on the depth of the box extender, you may need longer screws.
So if a switch or outlet is too far in the wall and you need something to flush it out to the wall face, a box extender is the answer.