tl;dr killall ControlStrip
After having used a MacBook Pro with a TouchBar for a few months, I've experienced a few times that the TouchBar can sometimes hang up so that none of the buttons work. I don't really use it that much, so I can just continue working, but it's annoying to not be able to change screen brightness etc.
The last few times I've just resorted to rebooting my computer after failing to google how to restart only the touchbar.
But today it was easier too google it. Cnet has an article that mentions various ways to fix it. For me it was enough to restart the ControlStrip, the rightmost part of the TouchBar.