The Safavid and Ottoman dynasties were both of Turkish ethnicity. The Safavid empire extended from the Caucasia ( Armenia, Azeribijan, etc.) to India, Iraq, the Persian Gulf, and parts of Central Asia and the Caspian Sea.The Ottoman empire, on the other hand, ruled the the rest of the Islamic empire (Middle East, Balkans, and North Africa).
The Ottoman empire was older and stronger than the young Safavid empire, but the Ottomans were alarmed as the Safavid strength and influence grew and felt their interest was threatened. Moreover, the Safavid followed Shia Islam, while the Ottoman people were followers of Sunni/Sufi Islam.
But the main reasons for the conflict are rather political than for sectarian religious factors as many try to force this idea of Sunni/Shia conflict.
As the Safavid empire grew, it pushed its territories as far as Iraq and eastern Turkey, carving for itself a considerable chunk of Ottoman territory. This was the point when the Ottomans felt in danger and waged war on their cousins the Safavid.
The religions of the Ottoman and the Safavid Empires were Sunni Islam and Shia Islam respectively.
How did the Ottoman Safavid and Mughal empires compared terms of location and size
The Ottoman and the Safavid empires were both founded by the Turkic nomads, and they had no defined principle of succession which led to civil strife.
Ottoman, Mughal, Safavid
Timur the lame halted the expansion of the Ottoman Empire in 1402 when he crushed ottoman forces in the battle of Ankara
The three great Muslim empires were the Mughal, Ottoman, and Safavid empires.
The Ottoman and Safavid empires faced frequent conflict with each other over control of the South Caucasus and Mesopotamia.
The Ming and Qing dynasties practiced neo-Confucianism, while the Ottoman, Safavid, and Mughal empires practiced Islam