You can use the Get-MgUser
cmdlet instead. And you can use server-side filtering to speed up the process a bit:
Get-MgUser -All -Property Id,UserPrincipalName,AssignedPlans -Filter "assignedPlans/any(c:c/servicePlanId eq 57ff2da0-773e-42df-b2af-ffb7a2317929 and c/capabilityStatus eq 'Enabled')" -ConsistencyLevel eventual -CountVariable count | select Id,UserPrincipalName
Do note the need for -ConsistencyLevel and -CountVariable parameters, as this is considered an advanced query.
Also, there are some intricacies in the format used when you want to check whether a specific service/plan is enabled, as I explain here: https://www.michev.info/blog/post/6137/how-to-properly-filter-for-specific-enabled-services-via-the-graph-api-sdk