Jelly, 1313 12 bytes
r²ÆṪ=€ḢTḢƲa+¥r²ÆṪ=€Ḣ$T+⁸Ḣ A monadic link taking an integer and returning the next integer with shared totient or zero.
Explanation
Main link (takes integer argument z)
r² | Range from z to z ** 2 inclusive ÆṪ | Totient function of each $ Ʋ | Following as a monad =€Ḣ | - Check whether each equal to the first, popping the first before doing so T T | - Truthy indices Ḣ +⁸ | - Head (returns 0 if the previous link returned an emptyPlus list)z ¥Ḣ | Following as a- dyadHead with(returns z0 asif the right argument and result of previous step aslink leftyielded (calledan xempty belowlist) a | - x and: + | - (x + z)