Hi @tommy.chheng thanks for reaching out to the Auth0 Community!
My suggestion would be to stick with Rules as they’re a bit more flexible but I’m not entirely sure of your use-case so I hesitate to advise too strongly. The Community Engineer Dan Woda has a great post about some of the functional differences between Rules and Hooks which might help you to determine where your code is best run.
If you can go into your use-case a bit more I may be able to point you in the right direction.
Best,
Colin