Shift work really messes with your body. What works best is forcing yourself to stay consistent even when your hours are all over the place. If you're working nights, you go to bed at dawn and sleep while it's light out - close your blinds properly or get a sleep mask. The key thing is getting your body to associate the bed with sleep, even if it's the middle of the day. Avoid natural light before sleeping and expose yourself to bright light as soon as you wake up - that helps regulate your biological clock.
On days when you're juggling shift changes, watch what you eat and drink. No caffeine after your last meal, even if you're feeling sleepy later. Alcohol might knock you out fast but it wrecks the quality and you'll wake up feeling like garbage. A walk outside in the morning or afternoon (depending on your shift) makes a real difference - it's simple but it works well for regulating your cycle.
And don't be too hard on yourself at first. Your body needs a few weeks to get the hang of it. If it's really unbearable after a month or two, you can think about seeing a sleep doctor - not necessarily for medication, just to get advice tailored to your specific situation. But from experience, most people adapt when they actually structure their environment and routine properly.