1. Preposition: When used to introduce a phrase that contrasts something with something else, it's a preposition.
* Example: "Unlike my brother, I love spicy food."
2. Adjective: When used to describe something as being different from something else, it's an adjective.
* Example: "The two houses were unlike in style."
So, to determine the part of speech, look at how it's used in the sentence.