The chains of this narration have flaws in it and this incident also goes against the Islamic guidelines which we find in Quran and Seerah of the Prophet (sws).
You can read further about it in the following articles which present the right picture in this regard:
https://islaahh.wordpress.com/2021/04/28/had-sayyidinah-khalid-ibn-al-waleed-r-a-drunk-poison-and-reamained-unharmed/
https://www.mathabah.org/consuming-poison-to-prove-islam-in-a-debate/
__
Such incidents, despite being weak or against the overall framework of religion, are usually quoted by some scholars to prove the concept of “Karamaat” in the context of Awliya and Tasawwuf and the psychology of current muslims has been developed as such where they are prone to be inclined to listen and believe in such incidents because these incidents somehow provide a surge to their religious sentiments and hold a certain emotional value. We must also not forget that a significant portion of the Muslim population is somehow influenced by Tasawwuf in one way or another.