Keyboard and trackpad disabled at login, keeps searching for Bluetooth
I have a 13" MacBook Pro bought in mid-2016.
This morning, I launched my MacBook and the trackpad and keyboard were not responsive. After about 30 seconds, a little window popped up saying "Bluetooth keyboard setup. There isn't a keyboard connected." I have left this window for as long as 15 minutes but nothing changes.
I have tried restarting my MacBook but this keeps happening. It has happened at least ten times.
I have also tried doing this in safe mode but this does not seem to make a difference.
I don't know if it matters, but for the past six weeks or so, I have been charging my iPhone 6s Plus via one of the USB ports. The cord is a little frayed and the connection isn't always perfect. When my iPhone would connect, it used to switch to the "photos" app, but it's hasn't done this for about a week, although the phone is still charging.
I have no idea what to do; my MacBook has now been rendered completely useless by this glitch. The keyboard and trackpad are completely unrecognised by the computer itself.
Any and all help are much appreciated.