I am trying to assign customized permissions to users/groups of SharePoint via the REST API. But from Microsft Graph we have only API to assign folder level permissions (read, write, full control). After seeing some links found out a NuGet package called SharePoint itself. So if there is any other way to achieve the above goal please do share it with me. I have shared a screenshot for reference, where test111 is a Domain group in SharePoint and test is a customized permission level I created in Sharepoint
Generally, REST API is used for Front-end, for your requirement, it is better to use CSOM code to assign users/groups permissions in your .Net Core solution.
To connect the CSOM code in .Net Core, you need to use modern authentication (SharePointOnlineCredentials class is not supported for .Net Core). An official article for your reference.
For granting permission to users/groups
SharePoint Online: Grant Site Permissions to User using CSOM.