I suffer from this too (only formally diagnosed with sleep apnea though) and found that 0.5mg of melatonin about 20-40mins before I want to go to sleep has helped me align my sleep cycle to a 24hr schedule. I also get a consistent 8hrs registered on my CPAP so it doesn't seem to interfere with my sleep quality/duration either.
I buy melatonin that comes in 1mg pressed/powder pill form and just bite it to split it in half and toss the other half back in the bottle.
I've been doing this for 2 years now and have never had to change the dose. At one point I even considered seeing if .25mg would be sufficient but depending on the brand sometimes the pill crumbles up too much so I stick with .5mg. I've used Nature's Bounty and Webber Naturals and both brands seem to work the same for me.
I really wish I had figured this trick out a lot earlier in life as it would've saved me from missing out on a lot of opportunities in my career.
(more detail about my experimentation below)
Before I discovered this I tried everything from reducing screen time before bed, cranking up night mode in flux/redshift, abandoning coffee/caffeine entirely, working out earlier in the day instead of evenings, etc. _Nothing_ worked for me - my brain would remain wide awake and I would have to stay up until 5-7am before I even began to feel tired (where I would have to wake up between 10-11am for work).
I had even tried melatonin before too but it was a 3mg pill and it would produce very erratic results in my sleep quality. I'd sometimes wake up drenched in sweat or wake up feeling very groggy for hours so I figured melatonin just wasn't for me. It wasn't until I came across some advice on /r/n24 or /r/dspd to try .5-1mg of melatonin that I decided to try again (IIRC it was a post about how doses >=2mg can actually result in melatonin overdose and result in the types of symptoms I was observing - TBH I didn't really bother verifying that info and just figured I'd try .5mg and see what happened as I was desperate for a solution).
And for the record, with this approach I haven't had to make any other modifications to my daily routine. I continue to lift heavy in the evenings and drink 1-2 cups of drip/espresso every day.
The only situations I've noticed where this trick falls apart for me are:
1) if I ever try to push past that 20-40min period where I start to get drowsy, it results in me being awake again. This rarely ever happens and I usually just end up sleeping about an hour later. I make sure to take the melatonin just before I begin flossing+brushing and get in bed right after
2) for some reason drinking a can of coke/pepsi in the evening will keep me wired awake all night. I've had cups of coffee in the evening rarely which never had the same effect, but coke/pepsi will...
Anyway, just thought I'd share since this made a huge difference in my life - maybe worth trying/experimenting.