Drupal - 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()
->getStorage('file')
->loadByProperties(['uri' => $uri]);