This is working code, as a workaround in using entityquery:
$query = \Drupal::entityQuery('group')
->condition('type', 'app_company')
->condition('field_netsuite_account_id', $CompanyNSAccountID);
// Convert to raw SQL as entityQuery->execute is returning invalid
// results.
$rawSqlQuery = $query->__toString();
$connection = \Drupal::database();
$rawQuery = $connection->query($rawSqlQuery);
$results = $rawQuery->fetchAssoc();
// Get the first gid value to load the group.
$gid = NULL;
foreach ($results as $result) {
$gid = $result;
}
if($gid != NULL) {
$group = Group::load($results[$gid]);
}