Whitebeard was 32 years old in God Valley. In my opinion, he honed his Haki after Rocks' death or disappearance. You have to stop thinking Roger was stronger than Garp; this flashback further proves their level is extremely equal, like Guy and Kakashi. So, even before Roger's death, Whitebeard was already the strongest. Remember that even with a much weaker crew and practically a teenager, Whitebeard made possible a two-day fight against all the Roger Pirates.
Regarding his title as the strongest man in the world, think of a UFC champion; even if he's sick, as long as he's not defeated, the title remains with him. That's how I think of the "title" of the old, sick Newgate. He hadn't yet been challenged for his title, and probably not the entire One Piece world knew about his illness.
In Marineford, he was no longer the strongest, Kaido and Shanks were probably stronger, Garp too, but he didn't want to fight because the condemned man was his grandson, Garp wanted to try to prevent Ace from dying by staying quiet.