Ajax modal does not show for authenticated users
For use-ajax to work for Anonymous as well as Authenticated user, Core core/drupal.ajax library must need to be loaded on page, where we're using 'use-ajax' class.

You can include this library with either using #attached in your Form or Controller or you can implement hook_page_attachments hook and attach ajax library.

If you're trying to add link to text inside your form, you can directly use #ajax instead of using classes as per directed in Ajax commands for opening and closing Dialogs and generic Dialog Controller added to core

  $form['link'] = [
    '#type' =&gt; 'link',
    '#title' =&gt; 'Link 1 (modal)',
    '#url' =&gt; Url::fromRoute('ajax_test.dialog_contents'),
    '#ajax' =&gt; [
      'dialogType' =&gt; 'modal',
    ],
  ];


Hope this helps.