Do I need a newer Mac if I want to continue to use Xcode with my iPhone?
Your computer is too old to be officially supported on macOS Mojave, I'm afraid. Also it is not possible to downgrade an iPhone to an older iOS version, unless you have saved certain information before you did the upgrade (which you didn't do).

However there are two unsupported methods of running macOS Mojave anyways, which will enable you to install Xcode 10.2 and develop for iOS 12.

The first option is to use the Mojave Patcher third party utility found here:

http://dosdude1.com/mojave/ 

It essentially patches a Mojave installation package to be able to run on older, otherwise unsupported hardware.

The other option is to use a virtualisation system such as VMware Fusion or Parallels Desktop and run Mojave inside a virtual machine.