It is very unlikely to get an STI by giving someone a hand job. Say the person did have an STI, then you would have to immediately touch your own genitals in order to infect yourself and even if you did it's very rare to catch it that way
I don't want to offend you. But I recommend not doing it. It can cause STI's if not EXTREMELY careful.