What is the correct way to implement a custom block with twig template?
You're almost there. In your WzmSocialIconsBlock.php return the following:

return array(
  '#theme' =&gt; 'block_wzm_social_icons',
  '#url' =&gt; $sUrl,
  '#urlencoded' =&gt; $sUrlEncoded,
);


You might also want to simplify your hook_theme by letting it autodetect your template by name:

return array('block_wzm_social_icons' =&gt;
  array(
    'variables' =&gt; array(
      'url' =&gt; null,
      'urlencoded' =&gt; null
    ),
);


And name your template templates/block-wzm-social-icons.html.twig.