iPhone or Apple Watch as an external keyboard for an iPad
In order to make an iPhone appear as a Bluetooth keyboard/mouse/HID you need to jailbreak it. It is not possible to an iPhone as a keyboard as of today running iOS 11.0.x.