that’s why you’d make the level of UVB radiation low enough that people could safely spend 24/7 under it, but high enough that it provides a health benefit
You might not get 100% of your vit D levels this way, but perhaps just a fraction of it. Depends on how the risk benefit calculation works out.
and of course infrared is generally harmless as long as it’s not strong enough to cook you.