Control access to a custom blocks edit page
/**
 * Implements hook_permission().
 */
function my_module_permission() {
  return [
    'my_module_custom_permission' =&gt; [
      'title' =&gt; t('My Module Custom Permission'),
      'description' =&gt; t('Explain what this permission allows the user to do.'),
    ],
  ];
}

/**
 * Implements hook_menu_alter().
 */
function my_module_menu_alter(&amp;$items) {
  $items['admin/structure/block/manage/block/5/configure']['access arguments'] = ['my_module_custom_permission'];
}

If you use the code above, follow the steps below.
Steps

Replace all instances of 'my_module_custom_permission' to a machine name that makes sense.
Update the 'title' and 'description' for the custom permission.
Replace all instances of the word 'my_module' with your module's machine name.
Change the $items path from what I have to the block path you are trying to update.

Important to note
If the block you are editing was created from the frontend of the Drupal website, then it can be deleted. If it gets deleted and then recreated, the block's ID will change. Which in turn changes the path to the block's configuration page.
Testing
Make sure to give your test user the permission we've just made and make sure they can edit the block configuration. Also, test a user who does not have the permission and make sure they can not edit the block configuration.