It seems that you might be having fungal infection
on your foot and now spread on penis mostly due to your fingers touching foot and then to penis.
Apply anti-fungal cream on both the sites.
Go for oral anti-fungal medicine like Flucanozole 150 mg once in a week for 4 weeks.
Keep local part clean, dry and airy.
Ok and take care.