"Yellow lines separate traffic flowing in opposite directions…A solid yellow line indicates that passing is prohibited." –Manual on Uniform Traffic Control Devices
As any crime-scene tech will attest, there's a reason why yellow tape is so ubiquitous, both on TV and in real life. It has to do with something called Locard's Theory of Transfer, which asserts that when people enter a crime scene, they leave evidence behind and take evidence with them. Random people wandering around crime scenes contaminate evidence, potentially undermining a case. That's why it's possible to be arrested for crossing crime-scene tape; in some states, the penalty is as much as two years in prison.
Why yellow? Scientifically speaking, it's believed to be the most eye-catching color. Because of the way light bounces off the eye's rods and cones, we see it more quickly than, say, red. And it's also likelier to be seen by more color-blind people than other hues.