You can break permissions inheritance and grant excusive permissions on folders as well in SharePoint online.
Follow below steps:
Go to document library
Click on ellipsis (...) - three dots next to folder name & select Manage access
It will open a panel at right side of screen. Scroll to the bottom of panel & click on Advanced link
It will open ...
To create a group & grant permissions, you need a permission level that includes permissions to Create Groups and Manage Permissions. The Full Control level has both.
Also, You can go to site permissions
page directly using the URL in this format:
Check this documentation to create a SharePoint Group.