How to implement a text field formatter that renders a URL as the image?
You can follow the Drupal.org example on creating a custom Field Formatter. Inside the viewElements function, you can add an if statement to check if the remote file exist. If it does, assign the url to the markup. If not, assign some text:

viewElements(FieldItemListInterface $items, $langcode) {
    $element = [];

    foreach ($items as $delta =&gt; $item) {
        $file = $item-&gt;value;
        $file_headers = @get_headers($file);
        if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
            $url = Url::fromUserInput($file);
            $markup = "&lt;img src={$url-&gt;toUriString()} \&gt;";
        }
        else {
            $markup= "File Not Found";
        }
      // Render each element as markup.
      $element[$delta] = ['#markup' =&gt; $markup];
    }

    return $element;
  }


Part of this answer is from stackoverflow.
I have not tested this, but it should be close.