In Firefox, the hotkey "cmd-K" will put focus into the search bar at the top.
In Chrome they don't have a keybind set to this by default (though on Windows they seem to). But if you open mac System Preferences, go to Keyboard, then Keyboard Shortcuts, and add an Application Shortcut for Chrome, you set the menu item name to "Search the Web..." and the keybind to whatever you want (I used "cmd-K").
So that way regardless if I'm in Firefox or chrome, pressing cmd-K will put me in a place I can search.
you can also have different engines
i have one for ddg so