I have been trying to work on improving legato technique however I am having an issue with my third finger touching the string I am playing when pulling off the string using a 4 2 1 finger combination. It's driving me mad as I can't seem to keep my third finger out the way, when I try to lift it up slightly I feel too much tension and it is very difficult to keep out the way. One other issue is my fourth finger trying to stick out when I hammer my second finger down. Any advice would be great as I am really trying to get to grips with this technique. Cheers
I think that you haven't developed enough finger independence yet. I don't know for how long you have been playing, but it is an issue that every guitarist has in the first months of playing.

I really don't have any advice on developing finger independence. For me, it just came with time. Also slow down the tempo on your metronome (hope you are practicing with one). Put it REALLY slow if necessary. Watch carefully how each of your fingers move, and try to correct their motion.

In other words, and taking the first case you mentioned as an example, try not to touch the string with your third finger. Again, you may have to slow the tempo on your metronome to be able to do this. No shame in doing things reaaaally slow if you need it.

With time, you'll have more and more control on each finger and you won't have any of this issues in the future. Just keep practicing and take it as slow as you need
Finger independence can be a tough "technique" to isolate and practice. Anything that gets all 4 fingers working though should benefit you. Typically the 1-2-3-4 spider exercise come to mind. Could also be worth tackling some more unorthodox barre chords

You are focusing on specifically legato though, so this lesson is the first one that comes to mind:


The whole thing is worth checking out, but notably the example at 3:40