how do i detect right clicks on a block while holding an item?

I know it's possible from what i've seen with a few datapacks but I wanna do it myself for an item that basically just reverses stripped logs lol
Continue to help post