Usually it comes from a person of authority to a subordinate. That might be a parent/child, supervisor/employee, or teacher/student relationship. Anyone who's in charge might say it to someone they're trying to get to get a result or answer from. Note in the clip above, it's a police officer talking about a teenager.
I might use it jokingly with an adult friend if I'm trying to convince them to do something, but it's generally not used between peers. There's an element of authority (presumed or real) with it.
It's often used when someone's being argumentative or making excuses for why they won't do what you're asking them to. It doesn't necessarily have to be for deliberately disrespectful comments.
There's also an alternate version that's kind of an abbreviated imperative: "None of your lip!"