Magento 2.4 deprecates class \Magento\Framework\App\Action\Action and suggests using \Magento\Framework\App\ActionInterface. But what about dispatch() method? I need to do some checks in controller (e.g. check config variable). Can you give me some example of dispatch method in this case
Your class should implements Magento\Framework\App\Action\HttpGetActionInterface
https://developer.adobe.com/commerce/php/development/components/routing/#action-class
If it's a custom controller, you can perform your checks in the execute() method. If it's from a vendor you can use a beforePlugin on the execute method.
https://developer.adobe.com/commerce/php/development/components/plugins/