Problem setting user specific cache tags on custom block with user context
To sum up the comments: As a general rule, if you render the current user, then always add the correct cache metadata to the render element:

 public function build() {
    return [
      '#markup' =&gt; '&lt;span&gt;Current User ID: ' . \Drupal::currentUser()-&gt;id() . '&lt;/span&gt;',
      '#cache' =&gt; [
        'contexts' =&gt; ['user'],
        'tags' =&gt; ['user:' . \Drupal::currentUser()-&gt;id()],
      ],
    ];
  }


If you have a block, which doesn't return a cacheable render result in all cases, you can add additional cache metadata in the block plugins cacheable dependencies methods. It doesn't harm when you declare a cache tag or context twice.