In regards to setting up UV distance, it's based on wanting to achieve a certain UVI level at the basking surface. A few factors can affect what UVI level is on a surface such as the strength of the bulb, if the bulb is housed in a fixture with a reflector, if there is a screen in the way.
Luckily, since there are not many scenarios or bulb types out there, we pretty much know what kind of UVI levels to expect out of specific bulbs given a set of circumstances.
Most would agree that a UVI level around 3-5 is ideal at the basking surface for a bearded dragon. An unobstructed T5 10-12% bulb in a reflector housing can achieve this at a distance of 12-15 inches away. At 8 inches away, it is much higher than a 3-5. So in your case, the screen blocking some of the intensity is actually a good thing as the average screen will cut down the UVI level by near 30%. That's what makes 8 inches away from the basking surface an ideal situation in your specific case.
If you mounted the bulb inside the tank, and your basking surface was now only 4 inches away, you'd fry your dragon with UV. The UVI level at 4 inches away is extremely strong and extremely damaging to cells.
We really only worry mainly about basking surface UVI. Your dragon will have lesser exposure throughout the tank. That is not only ok, it's ideal. UV, while necessary, can also be harmful. And it's important for there to be a gradient for UV just like you have a temperature gradient.
In my tanks, I have a UV gradient down to 0 (shade) on the cool end.
-Brandon