Well first of all, the best way to get vitamin D is from sun exposure so if you’re able to, dial that in.
For the supplements, ideally you take earlier in the day and ideally with fat. What I’ll usually do is take them with whatever my first food of the day is. Sometimes it’s a light meal midday, other times a shake, other times it’s an early dinner. In the depths of winter when I’m getting absolutely zero meaningful sun exposure, I’ll also pop one early in the morning. Yeah it’s not gonna absorb too well but it can’t hurt.