You'll have to create code to detect the phone and control a port pin (which will be connected to a relay module) when the phone is near.
Install ESP32 boards in your Arduino IDE (plenty of help on Goggle for this), and look under Bluetooth and BLE (Bluetooth Low Energy) examples to see what has has been done already. Chances are, there's something already existing you can adapt to do what you want.
Yes, it will take some effort. But it will be much simpler than trying to redesign something that's totally wrong for you application.