It's actually also used in informal settings among people of the same rank and not necessarily only as described as above. It's also used as a friendly and gentle invitation and sometimes just as a simple verb in the indicative.
It's not always used as an order with people of different rank and yes, it can be interchanged with 'continue' in some circumstances.
It's quite diverse and there are actually more examples with 'carry on' and 'carry on with':
"Carry on with what you are saying. I love listening to what you have to say " = continue with what you are saying . . .
"If you carry on in such an immature/childish/improper way, I am leaving the room" = If you continue (acting/behaving/talking in a certain way), I will leave . . .
"Carry on with what you're doing. I'll be back in a minute" = Continue with what you're doing . . .
"If you carry on with him/her, we will have to part ways" = If you continue seeing/being/interacting/being in a relationship with someone, we can no longer be together.
"If you carry on eating junk food, you will get more unhealthy." = If you continue eating . . .
So 'carry on' can mean 'continue' and it's 'carry on with + person' or 'carry on with + verb"