Hello there,
You can use below the API to get the site by searching the sitename,
https://graph.microsoft.com/v1.0/sites?search="NameofSite"
In PowerShell use the below command,
Get-MgSite -Search "NameofSite"
To get server-relative URL for a site resource, you can construct a request as GET /sites/{hostname}:/{server-relative-path}, refer access-a-site-by-server-relative-url
Similar discussion here https://learn.microsoft.com/en-us/answers/questions/1178627/get-mgsite-search-*
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–