1) Stand in front of a vertical mirror, making sure you are square to the mirror.
2) Place a horizontal ruler on the surface of the mirror.
3) Close one eye and move your head until the reflection of the centre of your pupil lines up with zero on the ruler.
4) Keeping your head still, open your eye and close the other eye.
5) The Pupillary Distance is the reading on the ruler that lines up with the centre of the reflection of your pupil.
6) If you want to double check it, just swap the opening of your eyes and check that the other eye still sees itself at zero.
I use this method whenever I order glasses online and have yet to have a pair of glasses that have any error in the manufacturing. I now only buy glasses online.
a) The method works because placing the ruler on the surface of the mirror guarantees that it is parallel to the mirror. The source and destination of the light ray is your pupil, so the ray is guranteed to be perpendicular to the mirror and the ruler.
b) The plane of your pupils needs to be parallel to the mirror/ruler. This is easy to judge as your eyes will be relaxed and looking straight ahead at your own reflection in the mirror. If your eyes are looking left or right you need to turn your head so you are looking straight ahead. People are generally pretty good at judging "straight ahead", so chances are that you are doing this correctly.
Satisfying the above two constraints means the geometry gives an accurate measurement, probably more accurate than an optometrist can judge by holding a ruler up to your eyes and trying to guesstimate that they have no parallax error.