These two verses in Sura Al-Baqara are very clear that no friend can intercede to his friend on the day of Judgment just because of their friendship or partnership (O you who believe, Spend from what have provided you, before a Day comes when there will be no bargaining, nor friendship nor intercession). This is stated in verse 2:254. It is clear that mere friendship or partnership will never allow intercession. In verse 2:255 which is known as Ayatul Kursi, it is stating that no one can intercede but only by Allah's permission. There is no contradiction at all if you understand the real translation of the verses.
Verse 2:254 refutes materialistic intercession, while verse 2:255 states the real intercession by permission of Allah.
Verse 9 of Surah Fussilat says: "The earth was created in two days" and verse 10 says: "The mountains, blessings and food of the earth were created in four days"; Following these verses, the creation of the heavens is also mentioned in "two days". It may be thought that the sum of these is eight days. But we must note that the two days mentioned in verse 9 are also part of the four days mentioned in verse 10; In this way, in the first two days, the earth was created and in the next two days, other characteristics were added. In fact, verse 9 speaks of the creation of the earth, and verse 10 discusses the total stages of the creation of the earth and its preparation for life.
translated from the Persian website of Ayatullah Naser Makarem Shirazi
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.