Yes , I understand your problem ... Lots of my friends students (and people from this site !) had it for a while , it's also quite common among acoustic guitarists when they begin elec and use distortions.
Like I said , it's a muting problem ... When you use distortion and play melodic lines , you only want to hear one note at a time , so you have to make sure that when you play a note , the previous note should be muted not to interfere with the new note and make unwanted noise .... This problem only appears when you're changing strings of course.
There are two kinds of muting , picking hand and fretting hand ... I'll also try to give you examples.
A) Fretting hand
1- By resting a finger on higher strings (if you're playing a line on g-string , you can rest your index on both b & e strings)
2- By touching the lower next string (if you're playing a line on g-string , you can touch the D-string with the index finger)
3- Using the thumb , from above the neck to mute the lower strings . (typically , it's used for the low E-string , but you can reach the D-string or higher , depending on your neck's thickness and how tall your fingers are)
B) Picking Hand
1- If you hold the pick with thumb and index only , you have three free fingers that you can use to mute ... rest those fingers on strings higher than that one you're playing . (if you're playing a line on the D-string , you can use the other three fingers to mute the g,b & e strings)
2- Use your palm to mute lower strings. ( if you're playing a line on the D-string , use your palm to mute both E & A strings)
Try to learn all these techniques individually ... After a while they're gonna be very natural to you , you won't even bother yourself thinking about it again. ;)