How to get a referenced taxonomy term name on a node in Drupal 10

To get node object using node parameters,

$node = \Drupal::routeMatch()->getParameter('node'); 

if (!$node) {
  return;
}

// Here field_tag is the machine name of the referenced taxonomy term
$term_name = $node->field_tag->entity->getName();

Category