How to stop a function while colliding with the character

There are various options to do so:
As suggested above you can stop the tick function SetActorTickEnabled false,
if you still need a tick function for other sort of things you can add a boolean variable - and perform your function while the var is true - on begin overlap you can set it to false and on end overlap you can return it back to true.