The people made camp with the Messenger of Allah ﷺ at the land of Thamud, al-Hijr. They drew water from its well and kneaded their dough with it. The Messenger of Allah ﷺ then ordered them to pour out the water they had drawn from that well, to feed the kneaded dough to the camels, and to draw water instead from the well from which the she-camel used to drink.
أن الناس نزلوا مع رسول الله ﷺ أرض ثمود، الحجر، واستقوا من بئرها، واعتجنوا به، فأمرهم رسول الله ﷺ أن يهريقوا ما استقوا من بئرها، وأن يعلقوا الإبل العجين، وأمرهم أن يستقوا من البئر التي كان تردها الناقة.
Bukhari narrated it in the chapters on the hadiths of the prophets (3379), and Muslim in Zuhd and Raqaiq (2981), both through Anas bin Iyad, from Ubaydullah, from Nafi, that Abdullah bin Umar informed him of it, as mentioned. The wording given is Bukhari's, and Muslim did not state the wording for this chain, but instead referred back to the wording of the chain before it.