@navdeepbajwa
The rule is "like" is used to compare nouns, while "as" should only be used to compare clauses.
For example:
My Uncle looks like Batman
My Neighbor yelled as though he were a maniac.
But this is also dependent on the context of the sentence. In the examples you provide, the words "like" and "as" change the meaning of the sentence.
Caesar works like a slave. The word "like" is used to describe Caesar's work schedule. The connotation here is that Caesar works hard and for long hours.
However...
Caesar works as a slave. The wording states that Caesar is a slave, which may or may not be true depending on the content of the sentence.
In these cases, look at the original intent of the sentence and try to follow the sentence's logical meaning.
HTH!