Programmaticaly remove a member from a group Using the Group module, what is the function to remove a user from a group using its user ID and the group ID?
The entity type interface (GroupInterface) has a removeMember method; all you need are the relevant entity objects:

if ($account = \Drupal\user\Entity\User::load($user_id)) {
  if ($group = \Drupal\group\Entity\Group::load($group_id)) {
    $group-&gt;removeMember($account);
  }
}