You didn't provide much in the way of details, and so I'm at liberty here to make assumptions. I'm going to assume you have a fungal infection on your feet. I make this assumption simply because my feet are the only places I've ever had fungal infections.
Fungus requires darkness, warmth, and moisture to grow. I always had a bad habbit of sleeping with socks on. Sleeping with one's socks on are a good habit to get into when one WANTS to have a fungal infection. Thing is, no one wants to have a fungal infection. So sleeping with socks on, especially during warm months, is a horrible thing to do.
So do not sleep with your socks on. I've had pretty awful fungal infections on my feet, and I used no medication at all to treat it. I simply stopped sleeping with my socks on, and though it took a while, the infection cleared up because there was not the degree of warmth from the socks, or moisture trapped by the socks for the fungal infection to continue to thrive.
Again, I'm assuming you have a fungal infection on your feet because this is what I have experienced myself, and you provided nothing in the way of specifics.