In magento 1 I can get module name using below code:
How can I get module name in helper magento 2?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
You can still do that in M2.
$this->_getModuleName() would still work, provided your helper class extends
\Magento\Framework\App\Helper\AbstractHelper (which most of the time it should, anyway).
PS: As for fetching the module name in observers, that's a different story. One which needs more details. Or another question even. Do you want to get the module of the current observer? You could implement something similar to what