Synonyms are different words with similar or identical meanings. Antonyms are words with opposite meanings, thus antonym is the antonym of synonym.
An example of synonyms, which can never occur singly because each synonym must refer to another word, are the words cat and feline (as a noun). Each describes any member of the family Felidae. Similarly, if we talk about a long time or an extended time, long and extended become synonyms.
Synonyms can be nouns, adverbs or adjectives, as long as both members of the pair are the same part of speech.
However, different words similar in meaning usually differ for a reason, feline is more formal than cat; long and extended are only synonyms in one usage and not in others, such as a long arm and an extended arm.
The purpose of a thesaurus is to offer the user a listing of similar or related words; these are often, but not always, synonyms. See hyponym for a closely related phenomenon, "words included in other words", as tulip is included by flower, but not vice-versa.
In contrast, antonyms (an opposite pair) would be: