The two hadiths that appear to be contradictory are:
Narrated Al-Bara: The last Sura which was revealed in full was Baraa (i.e. Sura-at-Tauba), and the last Sura (i.e. part of a Sura) which was revealed was the last Verses of Sura-an-Nisa’:– “They ask you for a legal decision. Say: Allah directs (thus) About those who have No descendants or ascendants As heirs.” (4.177) (Bukhari 4364)
Narrated Ibn `Abbas: The last Verse (in the Qur’an) revealed to the Prophet (ﷺ) was the Verse dealing with usury (i.e. Riba). (Bukhari 4544)
Reconciliation

Translation: As for the verse, the hadith of Ibn ʿAbbas has already preceded in Surat al-Baqarah (hadith 4544), stating that the last verse revealed was the verse on riba.
Reconciliation is that neither of them narrated based on direct transmission from the Prophet ﷺ, but rather from their own inference based on what they were aware of. The stronger reconciliation is that each one intended a different type of finality.
As for the surah (Baraʾah), the intent is part of it or most of it—since many of its verses were revealed before the Prophet’s final year. More decisively, the beginning of Baraʾah was revealed after the conquest of Mecca in the ninth year, during the Hajj of Abu Bakr.
While the verse “Today I have completed for you your religion” (Al-Maʾidah: 3) was revealed during the Farewell Hajj in the tenth year. So the apparent meaning is that most of Baraʾah was revealed last.
There is no doubt that most of Baraʾah was revealed during the expedition of Tabuk, which was the final military campaign of the Prophet ﷺ. In the tafsir of “When the help of Allah comes”, it will be mentioned that that surah was the final full surah revealed, and the reconciliation between the various views will be explained there, if Allah wills.
Some have said that the final part of Baraʾah that was revealed was the verse: “If they repent, establish prayer…” (al-Tawbah: 5), and others said it was: “There has come to you a Messenger from among yourselves…” (al-Tawbah: 128).
The soundest view, as stated earlier in al-Baqarah (2:281), is that the last verse revealed was: “And be conscious of a Day when you will return to Allah.” Al-ʿIzz ibn ʿAbd al-Salam narrated that this was the last verse revealed, and the Prophet ﷺ lived for fifty days after it. Then the verse in al-Baqarah was revealed. And Allah knows best.
Fath Al Bari By Ibn Hajar (13/323)
