Get page title form url
From below code example you can get the page title as your requirement

 $path = \Drupal::service('path.alias_manager')-&gt;getPathByAlias('/news-events');
 if(preg_match('/node\/(\d+)/', $path, $matches)) {
  $node = \Drupal\node\Entity\Node::load($matches[1]);
 }
 echo $node-&gt;getTitle();


Hope this helps. :)