Under the FIFA Laws of the Game it is not true that a cautioned player must leave. The rules of competition may stipulate that they must.
NFHS (US High School) rules do require that a cautioned player leave the field. A substitution is allowed in this circumstance.
Soccer referee
It usually is called a penalty and is showed by a yellow flag.
In most cases play continues. If it was done on intentionally, it depends on the referee but sometimes a yellow maybe even a red card.
It is a warning
sometimes a card and sometimes they wll just speak to the player
A caution, by showing a yellow card, or a send off, by showing a red card.
if it denies a goalscoring opputunity a red, if not yellow and final warning
Yellow as a warning, red to be sent off.
His job is to call fouls and make sure the game is fair, fun, and played right.
According to the Laws of the Game, this would be sanctioned by cautioning the goalie and the player that switched and showing them both yellow cards.
In the end it's the referee and ONLY the referee who makes the call, but if a linesman sees something illegal on the field he can raise his flag to notify the referee that he has seen something and then tell the referee what he saw.
Referees can wear Blue, Red, Green, Gold (yellow), or Black. The color choice depends on the kits being worn by the teams in a specific match because the referee must be easily distinguishable.