Question: What is the ruling concerning what a flood mixes together and drags away from a market to a distant place, such that one person’s property is no longer distinguishable from another’s, in addition to the fact that the people of the market are many?
Answer – and Allah is the One who grants success: If the owner of some item that the flood has dragged away cannot be identified, and the people (involved) are many such that it is not possible to distribute it among them, then it becomes for public interests (al-maṣāliḥ), and is spent therein; and the poor are among those public interests.
As for what it is possible to identify its owner, or where those involved are few such that it can be distributed among them, it must be returned to its owner. In summary, its ruling is the ruling of lost property, and Allah knows best.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2