How can I programmatically create a link/URL with querystrings set from parameters?
Let's say if your $args is an array like below:

$args['content_type'] = 'type';


Then you have to append type to it rather than just giving your $id to $args

$args['content_type'] = ['type' =&gt; '123'];


Then your overall query will be like:

$this-&gt;args = \Drupal::request()-&gt;query-&gt;all();
$this-&gt;args = [$id =&gt; $value];
$url = $this-&gt;url = Url::fromRoute('&lt;current&gt;');
$url-&gt;setOptions(array('query' =&gt; $args));
$link = '&lt;a href="' . $url-&gt;toString() . '"&gt;' . $label . '&lt;/a&gt;';