Somehow i only found about this little gem only recently. In your layout xml you can use the
ifconfig parameter to hide or show block depending on your configuration. It works as following:
<block class="<VENDOR><MODULE>BlockMyBlockClass" ifconfig="vendor_module/group/configuration_option" name="my-block" />
Now when you make sure the config path
vendor_module/group/configuration_option exists, Magento will check the value for you. If it is true-ish you block will be shown, if not it will hide the block.
I tried to find documentation about this, but on the Magento devdocs website this keyword is not found. I have found some usages in the core though so my guess is that it's safe to use: