I'm the kind of person who seems to do really badly in typical office environments. I also found that while working on my attempt at a startup, I was very easily able to regularly put in 16-hour days and wasn't really bothered by it at all. But then my startup attempt totally failed, so maybe I wasn't actually doing very good work?
Regardless, what works for me is basically all based on lots of tested self-knowledge.
For example, I like making my environment hyper-comfy. I do better work in my pyjamas, on my laptop in bed, with a mug of coffee in hand. I also do great work curled up under a tree in the park with some cake. This is totally the opposite of what I've heard from other people - that putting on a suit and going into the office helps them. But for me, it's like anything my brain categorises as "work" is aversive and I don't want to do it, but anything my brain categorises as "not work" is fun and easy. It turns out that doing graphic design in my bed is "not work", but doing it in anything resembling an office building is "work". For me. You might have the opposite experience! So I think my advice is less "put your pyjamas on" and more "acquire a level of self-knowledge where you know whether you work better in pyjamas or in a suit, because you've checked".
I think it's also really important to ignore all the bad techniques that people suggest. For example, for years I followed advice like "tell yourself that if you just do the task for only five minutes, you can reward yourself with chocolate afterwards". I think this is terrible and bad and caused long-term damage to my productivity, because it essentially involves accepting this framework of "work is suffering and aversive and terrible, but if you suffer through it, then your life can be nice again afterwards". This is a bad framing! It's really important to me to affirm that work is rewarding or fulfilling or fun, it's something I'm interested in or passionate about, I want to do it, etc - and if I don't believe those things, I need to notice that and treat it as an alarm and dig into what the problem is, not take it for granted like a background truth! I basically spent years reinforcing the belief "if getting something done is important for your goals, then it's Work, which means it's inherently unpleasant and aversive" and I now think that's just about the worst thing you can believe. I notice myself feeling aversive about doing something for no other reason than that doing that thing would accomplish my long-term goals. But the same task, if categorised as "not work", becomes fun and enjoyable. Now I really try to avoid the bad strategy, and instead think, "I'll sit under the trees in this beautiful park and get this task done on my laptop while munching these delicious chocolates and it'll be great," NOT "I'll just finish this hateful aversive task and then I can have chocolate and go to the park afterwards".
I also now actively try to avoid advice like "take breaks to avoid burnout" because I've noticed that it hurts me; if I mentally categorise a task as "the sort of unpleasant work that I'd need to take breaks from" then I'll be less likely to do it. Just telling myself "this task isn't actually unpleasant, so I don't want to take any breaks from it, because I'm enjoying doing the task more than I'd enjoy taking a break" seems like it sometimes just... makes that thing true. And also, taking "breaks" seems to mostly be harmful to me, because I end up doing things (like mindlessly scrolling Twitter) which are net harmful to my mental state. It's much more important for me to actively pursue enjoyable things, and to very rarely try to "rest", because my brain seems to think that being really miserable counts as "rest" so long as I just avoid doing anything. Joy requires work - even if it's just "if I want to experience the joy of going to the Botanic Gardens, I gotta shower and put shoes on".
And I also strongly experience something I call "momentum" - doing one task makes it easier to do another, and succeeding at several tasks makes it seem more fun and enjoyable to do the next task. So, rather than taking a break, I need tasks that have low activation costs and high completion chances, to bootstrap a success spiral. Things like having Duolingo on my phone, so when my brain tells me it's tired, I have a small easy task I can do - "complete a Duolingo lesson". Then I don't fall into the negative spiral - lying in bed and scrolling Twitter, which makes me feel worse, which makes me feel a stronger need to take a break, which makes me scroll Twitter more, which makes me feel worse, etc. Instead I get into a positive spiral - completing my Duolingo lesson successfully, which makes me feel accomplished and a bit energised, which makes it easier to start a second task, which gets me into flow, so it's easier to start a third task...
But some people would be incredibly miserable if they tried to make that work for them, and would literally hospitalise themselves if they tried to minimise the amount of breaks they get and also rest less, so, like, YMMV and you should just test the things that actually work for you. I suspect I'm weird. I also suspect I'm literally never going to be able to make offices work for me, and normal employment kinda sucks. But I only know that about myself because I tried being employed in an open office and I was like wow, this sucks so much!
If things aren't working yet, you should probably test more things! Get all the ideas, figure out your specific quirks, test out what works for you (which might be the literal opposite of what works for someone else), try to be actively curious in the "hmm I wonder what would happen if I poked this with a stick?" sense.