Finding both AD users and groups

I need to locate both AD users and groups without know a priori what sort of data I have.

I can retrieve both types of data, but I can’t see how to unify the two sets of data back together again in the same order that they were provided e.g.

data "azuread_users" {
  user_principal_names = var.names
  ignore_missing       = true
}

data "azuread_groups" {
  names = var.names
}

locals {
  // TODO: How are we going to unify the two so we get the appropriate object_id  for each user/group?
}