It depends on what meaning you want to convey.
If your meaning is: "You have lung cancer, but I don't want to get it" (this is probably the least polite, because you're focusing on the fact of your friend's cancer):
I don't want to get lung cancer, like you did.
If your meaning is: "You don't want lung cancer, and neither do I". (Note that the "to get" is removed, because the friend can't "get" cancer - he/she already has it):
I don't want lung cancer, just like you don't.
I'm trying to avoid lung cancer, like you are. (That is, "are trying")
This is polite (because you're not focusing on the fact that your friend has lung cancer, but that he/she is trying to avoid or recover from it). It also uses the more active verb "avoid". The stronger verb emphasizes your strong desire not to get cancer.
This does stretch the meaning of "avoid" to include "recover from", but I think this is acceptable in casual conversation.