A synonym is a word or phrase that means exactly or nearly the same as another word or phrase in the same language.
The word "brave" has many synonyms:
Why do we need synonyms? Synonyms are also called as similar words. They are used to avoid repetition of the same words in a text. The meaning has to be exact or very close to the exact phrase. If it can be used as a replaceable word, it is called a synonym. Sometimes if the word does not come to mind, one can always look up for synonyms, to find the exact word.
Instead of using the word "beautiful" in a text repetitively, one can use words like good looking, attractive, pretty, lovely, gorgeous etc. It makes the text more interesting to read and also provides an opportunity to express different nuances.
How are synonyms different from meanings?
Meanings tend to describe the word. Synonyms are other names for the same word, that can be used interchangeably.
In the same example as above, "meaning" of beautiful is pleasing the senses or mind aesthetically. "Synonyms" of beautiful are attractive, pretty, lovely etc.
Can synonyms be used interchangeably in all circumstances? No. One has to apply the meaning in the context and then interchange the synonym; otherwise, the sentence becomes illogical.
The synonyms of the word "next" are following, nearest, close, proximate etc.
However, each word has a unique "meaning" attached to it. Unless the meaning of the synonym matches the word, it cannot be replaced.
My aunt lives next door - the meaning is my aunt lives nearby, close to me.
But it cannot be replaced as,
My aunt lives following door (or)
My aunt lives the nearest door etc.
The "meaning" of next is "coming immediately after"
The "meaning" of following is "as a result of"
We have to be cautious while replacing synonyms for words. By choosing one synonym for the other, it can subtly (not literally), influence or change the intent and tone of the text.