Use filters. Here's an example:
GET https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/any(c:c/SkuId eq e43b5b99-8dfb-405f-9987-dc307f34bcbd)&$select=id,userPrincipalName,assignedLicenses
The above filter is based on the SKUid (e43b5b99-8dfb-405f-9987-dc307f34bcbd is the ID of Microsoft Teams Phone SKU), you can do the same for individual services within a plan:
GET https://graph.microsoft.com/v1.0/users?$filter=assignedPlans/any(c:c/servicePlanId eq 4828c8ec-dc2e-4779-b502-87ac9ce28ab7)&$select=id,userPrincipalName,assignedPlans&$count=true
(this is an advanced query, so needs the ConsistencyLevel=eventual header)
You can get list of ids here: https://learn.microsoft.com/en-us/entra/identity/users/licensing-service-plan-reference