Magento 2 Get all the module list programmatically.

You can get the list of available modules in Magento 2. You can manually check your all the module list from app/etc/config.php

You can get all the Active module list using Magento\Framework\Module\FullModuleList class.

FullModuleList.php class used for getting all the module in Magento 2 whether its enable or disabled.

You can check the blog to getting only the  Active/Enable module list.

Check using Programmatically,

Call function from PHP file or template file, $this->getAllEnableDisableModule();

Output will be array of all the module in Magento Commerce 2.3.1,