I am a British citizen flying from the UK to Germany, stopping in Basel in Switzerland for about 5 to 6 hours waiting for a connecting flight to Dresden. Do I need to obtain a visa?
As long as the UK remains in the EU, you are also an EU citizen, so you cannot be required to have a visa to enter other EU countries. Switzerland is not in the EU, but it is a member of the Schengen system and participates in the freedom-of-movement regime, so you also cannot be required to have a visa there.
After the UK leaves the EU, its citizens will probably continue to enjoy visa-free status in the Schengen area, like citizens of most other countries with strong economies, but if the exit negotiations go particularly poorly then they might be required to have visas.
You are still in the EU, and Switzerland is an EFTA state, so you never ever need a visa to go there under the current rules.
For the record, you'll clear Immigration at Basel and then fly to Dresden without any border control (unless the flight leaves from a non-Schengen gate, which happened to a bunch of flights to Germany and Greece in late May)