If you are fast enough, you could walk backwards and if your melee weapon has enough range you can just keep getting the rex when it tries to bite you. Probably best if you use a pike.

More Rex Encountering Tips