Yes, there are international treaties that the UK would breach if they legalised narcotics. Those are:
The Single Convention on Narcotic Drugs, 1961
The Convention on Psychotropic Substances, 1971, and
The United Nations Convention against Illicit Traffic in Narcotic Drugs and Psychotropic Substances, 1988
The majority of UN members are bound by these treaties: 185 of 193 for the 1961 and 1971 treaties, and 189 of 193 for the 1988 treaty. For a full list of signatories and of parties to the treaties, click 'Status of Treaty Adherence' under each treaty.
As to what specific breach the UK would commit if narcotics were legalised, the answer can be found in one of the articles of the 1961 convention:
Article 4. General obligations
The parties shall take such legislative and administrative measures as may be necessary:
(a) To give effect to and carry out the provisions of this Convention within their own territories;
(b) To co-operate with other States in the execution of the provisions of this Convention; and
(c) Subject to the provisions of this Convention, to limit exclusively to medical and scientific purposes the production, manufacture, export, import, distribution of, trade in, use and possession of drugs.
In other words, we are bound by this treaty to enact legislation to ensure that the use and possession of drugs is limited only to medical and scientific use.