Load a media entity/object from a fid?
Using the service file.uses you get the file media object:

Example:

$file is a loaded file object.
$file = \Drupal::entityTypeManager()-&gt;getStorage('file')-&gt;load($fid)
$result = \Drupal::service('file.usage')-&gt;listUsage($file);


$result should now contain an array like so:

$result['file']['media']['4372'] = 2;


Where 4372 is the media id. and 2 the times the file is used.

From the docs of listUsage:

@return array
   *   A nested array with usage data. The first level is keyed by module name,
   *   the second by object type and the third by the object id. The value of
   *   the third level contains the usage count.