All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is permissible to take sedatives and use them as medication because they are originally permissible unless there is evidence of their prohibition. Moreover, there is a benefit in using them. The fact that these sedatives contain anesthetic substances does not make them unlawful due to the necessity that entails using them.
This is if you are referring to sedatives that are used for nerve tension and similar conditions. However, if you mean drugs like opium and the like, then it is impermissible to consume these drugs because they are intoxicants in principle. Ibn ‘Umar reported that the Prophet, sallallaahu ‘alayhi wa sallam, said, "Every intoxicant is khamr (wine), and every khamr is forbidden." [Muslim] Moreover, ‘A'ishah
narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said, "Anything that intoxicates is forbidden." [Al-Bukhari]
Allah knows best.