The Highway Code says do not overtake on the left, with two practical exceptions: when traffic is moving slowly in queues and your lane happens to be moving faster, and when you are turning left.
There is no offence called undertaking. What gets prosecuted is the driving around it: weaving between lanes, or passing at a speed the conditions did not allow.
It is worth knowing that the vehicle that caused the situation, usually by sitting in the middle lane, may also be committing an offence.