In TNG in season 3, we see the 'upgrade' of the Starfleet uniforms for the main cast (because of the tightness of the other uniforms). However, the rest of the crew (i.e. the non-main characters) still wear the old uniforms with the colored piping on their shoulders. I expect the real reason for this would be budget constraints for redoing all the uniforms, so they just left them in there, but is there an in-universe explanation for this discrepancy?
We see this a couple of times in the ST universe (DS9 does it, and so does the Generations movie).
I don't think it is directly addressed in-universe, but this happens in real-life when uniform and equipment changes are implemented in organisations like police forces and armies. When you have 100,000 people (approximate size of the British Army including the reserves) then it takes time to produce and distribute enough uniforms and equipment for each individual (who may need several shirts, a couple of pairs of trousers, and multiple other items).
Of course, you'd expect the ST universe and StarFleet's access to replicators to somewhat simplify the manufacturing and distribution process - but the replicator economy does seem to have limits from time to time. It's a bit more forgiveable in DS9 where they're supposedly "beyond the frontier".
At one point during my time in the military, four different variations of our field/working uniform was authorized for wear while on duty. As the uniform design, features or material were upgraded, the old uniforms were still authorized for wear. There are several reasons for this. One reason is that uniforms are made in bulk and a goodly supply of older style uniforms, in some cases, were still in the supply chain. No further uniforms of that style would be manufactured and as the supply depleted to a pre-decided level, that uniform would be 'decommissioned'.
Any individual who still had that 'model' of uniform in 'serviceable' condition were authorized to wear it. An exception to this was that some units or circumstances precluded variations in uniform appearance such as drill formations, parades, certain positions or posts, etc. where everyone was required to 'look alike' or wear 'current issue' (that is what 'uniform' means after all).
Starfleet being a military organization has similar protocols. That's why you see different style or color pattern uniforms on different people. The bridge crew because of their position would always be 'well dressed' with the most current issue uniform. The only deviation to this standard is if they're at a remote post or someone who held such an extremely high rank that they decide that their uniform can be just about anything they want because they're the only one. Think swagger stick and pearl handled phaser on the hip.
There are also some additional Starfleet uniform variances allowed for cultural differences. Here are some Starfleet dress code regulation references: