There are cases when you need to display Magento 2 CMS block inside a PHTML template file. To programmatically call the CMS block in .phtml template file please use this code:
<?php
echo $this->getLayout()
->createBlock(\Magento\Cms\Block\Block::class)
->setBlockId('my_cmsblock_identifier') //replace my_cmsblock_identifier with real CMS bock identifier
->toHtml();
?>
Note that your CMS block should exist and be enabled. If the CMS block is disabled or does not exist, this code will not display any content.
The use of createBlock method is a fast but not ideal way in terms of best practices.
So what you can do is add CMS block into your block using layout, use this code in a proper layout XML handle file and don't forget to flush Magento cache once the layout is changed:
<referenceBlock name="my-main-phtml-block">
<block class="Magento\Cms\Block\Block" name="my-main-phtml-block-cms">
<arguments>
<argument name="block_id" xsi:type="string">my_cmsblock_identifier</argument>
</arguments>
</block>
</referenceBlock>
Display it in PHTML file with getChildHtml block method:
<?= $block->getChildHtml('my-main-phtml-block-cms') ?>