How do you tell if lump on penis foreskin is cancer or just an irritated vein?

Penile lesion. You would need to see a urologist to be examined and do determine the cause for the lump.
Cancer not likely. It is very unlikely that you have penile cancer, however, it is not feasible to tell you what it is without examining the lesion and you should see your doctor at your convenience.