How can I identify if a Magento request is meant for the frontend or the backend?

I need to determine whether the current Magento request is intended for a frontend display or a backend admin area. I am performing this check within an observer and I have the request object available. I previously considered using the method below:

app()->getSingleton('manage/session')->retrieveCurrentUser();

However, I’m not convinced that this is the most reliable approach. Is there an alternative method that can more clearly distinguish between frontend and backend requests?

hey, anothr aproach i used is checking the admin route identifier. if it contains ‘adminhtml’ then it’s backend. i found this method worked pretty wel in most setups.

hey, have u triyed checking the app state using \Magento\Framework\App\State? i found that using getAreaCode() gives a more consitent result than sessin data. what do others think about this workaround?