All of the above: melatonin, diphenhydramine (Benadryl), CBD. Also valerian root, ashwaganda, some other herbs.
Melatonin is naturally produced in the human body but tends to be less effective with aging. Combing a quick release and time release capsule might help last through the night.
And, as mentioned, be careful to avoid caffeine and alcohol late in the day.
Regarding physical activity, I've never been able to predict when a walk, run or bike ride will wake me up for hours or make me sleepy. There's no pattern I can tell.
There's a theory that a habit of consistent exposure to the sun at certain times of day can help regulate the body and sleep cycle in ways our hypothetical ancient forebears supposedly did. But that can be difficult for folks with a busy life, work, family, etc. I try to get out for at least a walk in the morning, sometimes a jog or bike ride if my body is up to it. Chronic pain from arthritis and multiple injuries make me a slow starter and I often can't loosen up enough until late in the day to be able to exercise with relatively little pain. Sometimes after a nighttime bike ride or run I'm ready to fall asleep immediately; other times I'll be awake until dawn.
Depends on other stressors too. My neighborhood has declined badly the past two or three years, with neighbors arguing loudly, more violent crime, random gunfire, sirens, etc. Makes it difficult to relax and sleep. When I lived in a rural area with few neighbors, no such issues.