You can buy depth stops to attach to drill bits to make blind holes at a certain depth. But for occasional jobs you can gauge depth by using masking tape around the bit at the right depth. Or, as shown, drill through the center of a dowel section, using the bit you need for the hole. Cut the dowel so the exposed bit will be the depth needed for the hole.
When you need to duplicate multiple measurements on a larger project, it can be helpful to use a length of 1×2 or similar stock as a story pole. Cut or select a piece that is longer than the longest cut required. Carefully mark the height, width, depth and length of various parts onto the 1×2. The story pole will speed up marking for cuts, and matching parts will be cut the same.