If a keyboard becomes non functional, and a replacement is not readily available, or you may wish to login remotely to your Mac from another location perhaps:
What options exist (if any) to login to one's Mac computer using only an iPhone or iPad ?
If you want to avoid the firewall exceptions, there are options such as LogMeIn, which has an iOS and a web client, and is free for the first ten devices you want to manage. The caveat is that you must install an app on the device which you want to access. The iOS app works smoothly over both WiFi and LTE, in my experience.
A VNC client like this VNC Viewer would work. You'll have to first enable VNC access on your Mac, however.
For access over the internet (from outside your network), you will probably have to set up some firewall exceptions.