you would need to find a programming language and build a script doing what your wanting.
to use the potentiometer with the Pi you would need to use an analog to digital converter so you can feed the digital signal to the Pi
though this would be wired and performed through the GPIO inputs not remotely, you could host code on your Pi which is accessed from your phone, using your phone as the remote(perhaps a slide bar) and that would be performed remotely.
for the ouput youd need to look into digital to analog controllers or a motor control HAT for your raspberry
python is a good language, if it was my project id be looking at using Python, id google "raspberry python variable speed motor" and attempt to get that running first, then you could change the input to be what you wanted.
if you was to use something like a tkinter slider to adjust the motors you could test it all on the bench with a mouse and keyboard then after access the same code from your phone using VNC or putty or some other remote access software.