I have a content type with a media (image) entity reference field (field_thumbnail_image) and I want to grab its file URL. For this, I need to load the media entity, isolate its source object using getSource, then load this source as a file entity so I can make a proper URL.
// load the media entity from the media entity reference field
$media_entity = Media::load($entity->field_thumbnail_image->target_id);
// get the file source value for the media entity
$source_value = $media_entity->getSource()->getSourceFieldValue($media_entity);