Load a file entity by URI
There is the loadByProperties method in the \Drupal\Core\Entity\EntityStorageInterface that allows to define required condition in searching the file entity by the given file URI:
/** @var \Drupal\file\FileInterface[] $files */
$files = \Drupal::entityTypeManager()
  -&gt;getStorage('file')
  -&gt;loadByProperties(['uri' =&gt; $uri]);
/** @var \Drupal\file\FileInterface|null $file */
$file = reset($files) ?: NULL;