How to get a field value of custom block?
Fields of custom blocks are in block content. So you have to load the block content first, before you can get the field value:

$block = \Drupal\block\Entity\Block::load($block_id);
$uuid = $block-&gt;getPlugin()-&gt;getDerivativeId();
$block_content = \Drupal::service('entity.repository')-&gt;loadEntityByUuid('block_content', $uuid);
if ($block_content) {
  $field_value = $block_content-&gt;field_block_alt_title-&gt;value;
}