Here its called filtering and it's legal, so long as you're sensible. The UK has a "Highway Code" which is a set of rules, most of which have legal weight. This summary from a lawyer's website, who specialises in motorcycle personal injury claims.
" Filtering through traffic is one of the many advantages of riding a motorcycle, a scooter, or a moped. The downside is that it is one of the most dangerous things you can do. Drivers fail to see bikes at the best of times, let alone when you are approaching in a way they do not expect. Drivers who ride motorcycles understand, but drivers who only drive are constantly surprised by what riders can do, and they fail to take that into account. They do not think bike, or bicycle for that matter.Image shows motorcycle filtering through traffic
The Highway Code gives this advice to motorcyclists:
“Manoeuvring. You should be aware of what is behind and to the sides before manoeuvring. Look behind you; use mirrors if they are fitted. When in traffic queues look out for pedestrians crossing between vehicles and vehicles emerging from junctions or changing lanes. Position yourself so that drivers in front can see you in their mirrors. Additionally, when filtering in slow-moving traffic, take care and keep your speed low.” ..."
Motorcycle filtering through traffic | Mark Thompson Law
Basically, it's have your wits about you whether driving a car or a bike. I've never had an accident filtering, though I have occasionally had drivers see me coming in their mirror and move to block the lane. More often than not the alert drivers in the lanes I'm splitting each give a little space. Win win. I get home sooner, and don't occupy a car space in the queues, so they do too.