Turkish president Erdogan comes from a political tradition that's close to the Muslim Brotherhood and has often seen himself as one of the global leaders of an emerging network of Muslim Brotherhood dominated countries. However, following the collapse of the Arab Spring, Erdogan switched from being this transnational revolutionary to becoming a more limited, saving-his-own-regime type of leader.
When it comes to Iran, it's a very complex relationship. We call it a “frenemy” relationship. On the one hand, there is sectarian tension and competition between Erdogan's Sunni Islam and Iran's Shiite Islam. Nevertheless, both powers see each other as tactical allies in their challenge to what they see as a civilizational struggle against, again, what they see as a Judeo-Christian world.
Let me conclude with this: it's really unfortunate that Turkey is fuelling this type of antagonistic civilizational rhetoric, because Turkey itself is really the cradle where Christianity, Judaism, Islam, Baha'ism, and other faiths have basically flourished for centuries, if not millennia. Turkey, which should be the bridge-builder, the reconciliator, in the Middle East has become an instigator of religious intolerance and extremism under the rule of Erdogan.