Get image URL with image style

How to get image URL / URI with image style
<?php

use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;

// File ID.
$fid = 123;

// Load file.
$file = File::load($fid);

// Get origin image URI.
$image_uri = $file->getFileUri();

// Load image style "thumbnail".
$style = ImageStyle::load('thumbnail');

// Get URI.
$uri = $style->buildUri($image_uri);

// Get URL.
$url = $style->buildUrl($image_uri);