The URL type provides a textbox that allows the user to enter a URL and validates it for correctness. The URL type inherits from the textfield type and can use any attributes that apply to it as well. Let's look at an example:
$form['path'] = array(
'#type' => 'url',
'#title' => $this->t('Url'),
);

URL type with validation error