It is very clear that no Muslim says any expression like 'Ya Rasul Allah Madad', or 'Ya Ali Madad', with the slightest of intention that they are equal to Almighty God, or that they will help independently free of any involvement from God.
If, for argument sake, someone was to say anything like this, and believe that a Prophet, an Imam or a saint can within their own power independent from God they are performing Shirk, and this is forbidden and condemned.
But, if we were to seek intercession, or help, or call to any of God's creation, alive or dead, who have an exceptional status in the eyes of Almighty God and they be granted this position from God, then it is not Shirk, not is it a contradiction.
We seek forgiveness from Almighty God, but also in the Quran the Almighty says that the Prophet (s.a.w) can forgive us as well (Surah al-Nisa`, verse 64). We can also make reference to the story of Prophet Ya'qub (a.s.) and his children (Surah Yusef, 97-98).
As for asking which one is better? Tp say Ya Allah, or Ya Ali. This kind of question is meaningless, because it entails that they are equally parallel to each other, or one replaces the other. However, it is not the case. Each expression functions within its own usage. It is like saying 'should I say Ya Rahman, or Ya Rahim'.
Furthermore, there are many authentic traditions in both Sunni and Shia sources that validate the practice of Istighathah and Tawassul. Some Sunni scholars, like Imam al-Sabki, say it is a very good practice. In Sunni sources it also has a frequently mentioned tradition that 'remembering Ali is in itself an act of worship'.
Therefore, there is no contradition, and Muslims throughout the history of Islam have sought help from mediums other than Allah ta'ala, without any intent of Shirk. The Almighty has appointed Prophets and Imams as mediums, and therefore we are able to get to Him through them.