When your house or apartment was being built, electricians like me installed the boxes that hold receptacles and light switches in ... this problem with an electrical box extender.
Then position the outlet and switch on the wall directly under the ceiling box location. Screw a box extender to the existing ...