I'm not sure if you plan to develop something and then you are wondering if it's possible, or you just want to configure your phone with an existing app.
It is possible to configure the buttons using apps. There are a few apps in the Play Store:
https://play.google.com/store/apps/details?id=com.jamworks.sidekeybuttonremap&hl=en&gl=US
https://play.google.com/store/apps/details?id=flar2.homebutton
(more here: https://play.google.com/store/search?q=power%20button&c=apps)
Take the first one by example. It's listed in the list of possible actions under Accessibility > Advanced options > Accessibility shortcuts
(to be triggered when you press two buttons at once by example).
Also via UI, you can customize your side-key from Settings > Advanced features > [Side key][1]
, the Cog. But you probably already know that.
So, your app can be selectable to respond to physical buttons but is the user the one to configure that from the UI.
However, you can develop an accessibility service, by requesting the BIND_ACCESSIBILITY_SERVICE permission. And that will give you full access to buttons and more.