How to get all node entities tagged with a specific term?
You can use loadByProperties() to get all node entities that reference $term_id:

$nodes = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadByProperties([
  'field_tags' =&gt; $term_id,
]);