Custom redirect to an url with "+"
The URL you're building is taking the query (e.g. "word1 word2 word3") and replacing it with literal "+" chars for spaces. Hence, the %2B encoding in the string.

You don't need to parse/encode $form_state-&gt;getValue('textBox'). Per the documentation of Url::fromUri() for the $options param:


  
  'query': An array of query key/value-pairs (without any URL-encoding) to append to the URL.
  


$options['query'] expects its key/value pairs to have the literal strings.

You needn't worry about +/%20 encoding differences. They are different ways to encode the space character. (the + is an older space-encoding spec which you can do if absolutely needed, see rawurlencode, urlencode, &amp; http_build_query in the PHP docs).