The Get-MgUserMemberOf cmdlet does not only return Group objects, but Directory role and Administrative units as well. So this is not an issue with "non-existing group", but rather using the incorrect cmdlet to resolve the GUID.
If you expand the properties of the objects stored within your GroupMembership variable, you will be able to see what type of object is returned. Alternatively, if you only want to fetch actual groups, you can use this:
Get-MgUserMemberOf -UserId $UPN -All:$true | ? {$_.AdditionalProperties.'@odata.type' -eq "#microsoft.graph.group"}
You can also do the filter server-side, but the Graph PowerShell module does very bad at handling the output for that scenario, so I'll skip the example.