If you drink one beer then it's usually okay to drive soon after drinking the one beer.
But if you drink more than one beer then you should wait a few hours to 8 hours or longer to drive that way the beer and other alcohol you drink has time to leave your system.
If you plan to drink more than a couple of beers then it's a good idea to have someone available to drive you home or arrange for alternative transportation.
If I drink more than one beer then I always wait until the next day to drive my vehicle and will have someone else drive me home that doesn't drink beer.
I just want to make sure I'm safe to drive although I probably would be okay driving after 8 hours or so.
It's just not worth the risk of getting into a car accident and getting killed or injured or killing someone else or injuring them as well.