There is a theory in any language: can any two words be the same?
The general answer is no two words are 100% identical, yet they can be understood the same depending on the context.
This concept in Arabic is called:
إِذا اِجْتَمَعَ اِفْتَرَقَ وَ إِذا افْتَرَقَ اِجْتَمَعَ
If synonyms are used in the same sentence, they have different meanings; and if they are used in separate sentences, then they are the same.
The most basic example of this is in بسم الله الرحمن الرحيم
The words الرحمن and الرحيم both mean, The Most Merciful. However, since they are used together there must be some difference.
The scholars then gave some interpretations, with the understanding that الرحمن was more emphatic than الرحيم.
الرحمن: Mercy for believers and non-believers; Mercy in this world and the next
الرحيم: Mercy for believers only: Mercy only in this world
I hope this helps