I would say working for three hours straight on a problem (assuming you're focused the whole time) is a pretty good feat! Definitely takes a lot of mental energy.
After that, it's completely normal to need a good break before going back to work. Not just going to the bathroom or drinking a cup of coffee in five minutes, I mean an actual break. Get out of your workplace and interact with people if possible for at least half an hour. Then maybe you'll be able to start working again. Probably with lower performance than before, but hey, we're humans. We can only stay fully focused a few hours a day, so take it easy.
Regarding meditation, if you want some legit stuff just google zazen or vipassana, but don't expect some drastic results. It may help you a little bit with ignoring distractions or keeping anxiety away, but it's not a magic pill.