Load an entity from a URI
$params = Url::fromUri("internal:" . $source_uri)-&gt;getRouteParameters();
$entity_type = key($params);
$entity = \Drupal::entityTypeManager()-&gt;getStorage($entity_type)-&gt;load($params[$entity_type]);