I agree that Gibraltar is not the United Kingdom (such an assertion would be preposterous!), but that is not really what the question asks. The question refers to sovereignty.
Gibraltar and the Sovereign Base Areas of Akrotiri and Dhekelia both have coastlines on the Mediterranean Sea. Both territories are part of the UK’s sovereign territory, even though they do not technically form part of the United Kingdom. Given that UK sovereign territory is situated on the Mediterranean, I believe it is reasonable to assert that the UK is a sovereign state with a coastline on the Mediterranean.
Gibraltar and the Sovereign Base Areas of Akrotiri and Dhekelia both have coastlines on the Mediterranean Sea. Both territories are part of the UK’s sovereign territory, even though they do not technically form part of the United Kingdom. Given that UK sovereign territory is situated on the Mediterranean, I believe it is reasonable to assert that the UK is a sovereign state with a coastline on the Mediterranean.