Milk of the poppy is introduced in Game of Thrones as a medicine to treat those who are especially wounded. It's made with crushed up poppy flowers, which are then turned into a white drink of sorts, which is where the name comes from. Using a bit of milk of the poppy can help ease pain, but a higher dose can actually cause someone to go unconscious.
This means milk of the poppy can also be used during surgeries. And in Game of Thrones, we see Robert Baratheon take milk of the poppy when he's wounded in a hunting accident. It's referenced at other times throughout the series and then, in Season 6, Arya is given milk of the poppy to help heal her after she's stabbed by the Waif.
Milk of the poppy is, essentially, morphine. It's used to take pain away, but it also leaves someone sedated, or unable to think straight. This explains why Viserys finds it difficult to concentrate when Rhaenyra and Daemon first visit him at King's Landing in the Oct. 9 episode of House of the Dragon.
But this isn't a modern world where there are many other solutions for helping a dying king.