The best thing is to go out in the sun and soak in the required D. Shortcuts like vitamin pills will always have side effects.
Sunscreen is an endocrine disruptor
Vitamin D is an endocrine disruptor
You're fucked.
On a more serious note, I suppose moderation is key. Sunlight as much as easily doable, sunscreen only on the face (and check between physical and chemical sunscreen), and if you’re still deficient then take a supplement.