diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index 76dc46c77b..2d49f2bbac 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -269,7 +269,10 @@ public static function fromUri($uri, $options = []) {
     if (preg_match('/^base:\d/', $uri)) {
       $uri = str_replace('base:', 'base:/', $uri);
     }
-    $uri_parts = parse_url($uri);
+    // parse_url() incorrectly parses URI of the <scheme>:<path> type when path
+    // contains only number with 5 digits or less. (for example tel:911)).
+    // Prevent that by adding empty query to the end of the path before parsing.
+    $uri_parts = preg_match('/^[a-z][a-z0-9\-\+]*:\d{1,5}$/i', $uri) ? parse_url("$uri?") : parse_url($uri);
     if ($uri_parts === FALSE) {
       throw new \InvalidArgumentException("The URI '$uri' is malformed.");
     }
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index ff4cb01b8b..fbf5b89998 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -795,6 +795,52 @@ public function testFromUriNumber() {
   }
 
   /**
+   * Tests the fromUri() method with external URI without scheme.
+   *
+   * @covers ::fromUri
+   */
+  public function testFromUriWithExternalUrlWithoutScheme() {
+    $this->setExpectedException(\InvalidArgumentException::class);
+    Url::fromUri('example.com:8080');
+  }
+
+  /**
+   * Tests the fromUri() method with a URI of the <scheme>:<path> type when path
+   * contains only digits.
+   *
+   * @covers ::fromUri
+   *
+   * @dataProvider providerTestFromUriDigitsPath
+   */
+  public function testFromUriDigitsPath($uri) {
+    $url = Url::fromUri($uri);
+    $this->assertSame($url->toUriString(), $uri);
+  }
+
+  /**
+   * Data provider for testFromUriDigitsPath().
+   */
+  public function providerTestFromUriDigitsPath() {
+    return [
+      'tel_short_number1' => ['tel:0'],
+      'tel_short_number2' => ['tel:65535'],
+      'tel_short_number3' => ['tel:65536'],
+      'tel_short_number4' => ['tel:911'],
+      'tel_long_number' => ['tel:600000'],
+      'coap_tcp_short_number1' => ['coap+tcp:0'],
+      'coap_tcp_short_number2' => ['coap+tcp:65535'],
+      'coap_tcp_short_number3' => ['coap+tcp:65536'],
+      'coap_tcp_short_number4' => ['coap+tcp:911'],
+      'coap_tcp_long_number' => ['coap+tcp:600000'],
+      'ms_word_short_number1' => ['ms-word:0'],
+      'ms_word_short_number2' => ['ms-word:65535'],
+      'ms_word_short_number3' => ['ms-word:65536'],
+      'ms_word_short_number4' => ['ms-word:911'],
+      'ms_word_long_number' => ['ms-word:600000'],
+    ];
+  }
+
+  /**
    * Tests the toUriString() method with route: URIs.
    *
    * @covers ::toUriString
