Functions file_create_url() and file_url_transform_relative() are deprecated.

Instead, get file_url_generatorservice injected into your service or controller from the container and call its methods.

Before After
file_create_url($uri) \Drupal::service('file_url_generator')->generateAbsoluteString($uri)
file_url_transform_relative($file_url) \Drupal::service('file_url_generator')->transformRelative($file_url)
file_url_transform_relative(file_create_url($uri) \Drupal::service('file_url_generator')->generateString($uri)
Drupal\Core\Url::fromUri(file_create_url($uri)) \Drupal::service('file_url_generator')->generate($uri)