https://www.kof-k.org/articles/040208030446W-33%20Uncovered%20Beverages.pdf
In the time of Chazal there was a concern that one should not drink water,1 wine, milk,2 and honey3 that was left uncovered because of a snake whose venom might have gotten into the drink and it will cause the person danger. Today, snakes are not commonly found and therefore, most of klal yisroel are not concerned for this halacha (except for Kiddush, see below).4 However, there are some poskim who says that even today one should be careful with this.5 Some say even for those who are lenient, if the beverage was left uncovered all night one should be stringent.6 The Gr’a7 and the Chazzon Ish, among other gedolim, were stringent with this. It is said that the Chazzon Ish was concerned about leaving yogurt uncovered as well.9 Some say if one is careful with uncovered beverages he will not have foreign thoughts while davening.
Shulchan Aruch (YD 116:1) Exposed beverages were forbidden by the rabbis because they feared that snakes would have drunk from them, and left behind venom. But now when snakes are not found amongst us, it is permitted.
https://oukosher.org/halacha-yomis/is-one-permitted-to-drink-a-beverage-that-had-been-left-uncovered-and-unattended/
The Gemara (Avoda Zara 30a) discusses the laws of giluy (beverages left uncovered). Chazal forbade drinking certain beverages that were left uncovered, due to concerns that venomous creatures, such as snakes or scorpions, might drink from the beverage and leave behind some of their venom. Tosfos (Avoda Zara 35a: Chada) writes that in the countries where we live, this concern does not exist, and beverages left uncovered may be drunk. Ordinarily, once Chazal issue a gezeira (decree), the gezeira remains in force even if the reasoning no longer applies. This case is different since the original gezeira was only enacted for places where snakes were common. Accordingly, Shulchan Aruch (YD 116:1) rules that one may drink a beverage that was left uncovered. However, the Pischei Teshuva (116:1) writes that the position of the Vilna Gaon and the Shelah Hakadosh is not to leave drinks unattended. The commentaries to the Maaseh Rav explain that the Vilna Gaon held that there are secondary reasons for Rabbinic decrees that apply even when the primary reason is no longer relevant. Common practice is to follow the position of the Shulchan Aruch, though some adhere to the more stringent opinion.