I have "reference strips" of drywall laying around my shop, in the common thicknesses of 3/8" and 1/2". These strips are the width of the narrow side of a 2x4: 1 1/2".
Let's back up a moment: you will not be installing the electrical box with the box face flush to the framing stud. If you do this, when you hang the drywall your electrical box will be sunken into the drywall.
So, bring the face of the electrical box outward--toward the room--to the exact thickness of your eventual drywall. But since there is no drywall there yet, you kind of have to "imagine" where the drywall will be. Instead of imagining, it's far better to have some real drywall there.
Since I cannot install the real drywall yet, I screw the reference strip onto the framing stud next to the electrical box's installation point. This shows me exactly how far out the electrical box will be.