Analog pH BNC sensor, and DS18B20 temperature sensor issues

Hello everyone I'm having a big of a snag in my project and I'm really confused at what could be going on and how to rectify the issue.

I'm trying to use both an analog pH sensor that works off of 5v and a DS18B20 temperature sensor with the OneWire library on an ESP32. The pH probe works great and I've been logging away for days, but today was the day that my temperature sensor arrived in the mail and when I hooked it up my pH readings just steadily gave me a "6.45" with my calibration I assume that it is a "7".

I've tried tons of different creative ways to fix this, I even tried to power the DS18B20 using a separate power supply but everything seems to mess up the analog signal with my pH sensor.

Here is my code:

#include <WiFi.h>
#include <WiFiMulti.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// Dump //
int dumpCount = 0;
int dumpLimit = 500;

// WiFi Setup //
WiFiMulti WiFiMulti;
WiFiClient client;
const uint16_t port = 5000; // SurfBox Server port
const char * host = "192.168.1.188"; // SurfBox Server host
String line;

// pH Sensor //
float calibration = 1.0;
const int analogInPin = A0; 
int sensorValue = 0; 
unsigned long int avgValue; 
float b;
int buf[10],temp;

// Temperature Sensor //
#define ONE_WIRE_BUS 15
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tempSensor;

void setup() {
 Serial.begin(115200);

 // Temperature Sensor //
 if (!sensors.getAddress(tempSensor, 0));
  sensors.setResolution(tempSensor, 12);
  sensors.begin();

 // Connect to WiFi //
 WiFiMulti.addAP("Fios-LBPBU", "end9823wet8602meat");

  while(WiFiMulti.run() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // Connect to SurfBox Server //
  if (!client.connect(host, port)) {
      Serial.println("connection failed");
      Serial.println("wait 5 sec...");
      delay(5000);
      return;
  }
}
 
void loop() {

 // pH Probe Logic //
 for(int i=0;i<10;i++) { 
  buf[i]=analogRead(analogInPin);
  delay(30);
 }
 for(int i=0;i<9;i++) {
  for(int j=i+1;j<10;j++) {
    if(buf[i]>buf[j]) {
      temp=buf[i];
      buf[i]=buf[j];
      buf[j]=temp;
    }
   }
 }
 
 avgValue=0;
 
 for(int i=2;i<8;i++)
  avgValue+=buf[i];
  
 float pHVol=(float)avgValue*1.5/4095/6;
 float phValue = -5.70 * pHVol + calibration;
 
 Serial.print("pH = ");
 Serial.println(14.0 - (phValue * -1));
 
 delay(500);

 // Temperature Sensor Logic //
 sensors.requestTemperatures();
 delay(100);
 Serial.println("Temperature = "+ String(sensors.getTempFByIndex(0)));

 delay(500);

 // Send data to SurfBox Server //
 client.println("p 0 newr " + String(sensors.getTempFByIndex(0)));
 line = client.readStringUntil('\r');
 Serial.println(line);
 delay(100);
 client.println("p 1 newr " + String(14.0 - (phValue * -1)));
 line = client.readStringUntil('\r');
 Serial.println(line);

 if (dumpCount < dumpLimit) {
  client.println("p 1 dump");
  line = client.readStringUntil('\r');
  Serial.println(line);
  dumpCount++;
 } else if (dumpCount == dumpLimit) {
  client.println("p 1 clearhist");
  line = client.readStringUntil('\r');
  Serial.println(line);
  dumpCount = 0;
 }
}

If someone could please explain even in the slightest bit what could be going on

Ground loop?

Start by writing a simple program that only prints the raw pH sensor reading to the Serial Monitor. No WiFi, no DS18B20, no pH conversion. Run it on your ESP32 with only the pH sensor connected. Does that work as expected?

Now try the same code with the DS18B20 connected. Does it still work?

Now add in just enough code to read the DS18B20 and print the reading to the Serial Monitor. Does that still work?

One extra test:

  1. with the DS18B20 connected.
  2. with the DS18B20 connected and placed into the water the pH probe is also measuring.