Im making a follow me robot using a hc05 bluetooth module and a neo m8n gps module

I have two working codes for both which the hc05 receives data of latitude and longitude from an app i made, it prints to the serial monitor. The same with gps i have a code works which prints the current latitude and longitude of the gps module. NOw when combining them on one code either the bluetooth data shows and the gps data doesnt or the other way arounf. Ia there a specific reason why this happens??

//GPS CODE

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
SoftwareSerial gpsSerial(8,9);
TinyGPSPlus gps;

void setup() {

 gpsSerial.begin(9600);
 Serial.begin(9600);
  
  }

void loop()
{
  while (gpsSerial.available())
  {
    gps.encode(gpsSerial.read());

    if (gps.location.isUpdated())
    {
      double latitude = (gps.location.lat());
      double longitude = (gps.location.lng());
      Serial.print ("latitude: ");
      Serial.println (latitude, 6);
      Serial.print ("longitude: ");
      Serial.println (longitude, 6);
    }
  }
}


//Bluetooth CODE

#include <SoftwareSerial.h>

// Define pins for HC-05 communication
#define BT_RX 2  //TX
#define BT_TX 3 //RX

// Create software serial object
SoftwareSerial BTSerial(BT_RX, BT_TX);

void setup() {
  // Initialize serial communications
  Serial.begin(9600);  // For Serial Monitor
  BTSerial.begin(38400); // Change if not reading
  
  Serial.println("Arduino ready to receive Bluetooth data");
}

void loop() {
  // Read from HC-05 and send to Serial Monitor
  if (BTSerial.available()) {
    String message = BTSerial.readString();
    Serial.print("Received: ");
    Serial.println(message);
  }
  
  // You can also read from Serial Monitor and send to HC-05
  if (Serial.available()) {
    String message = Serial.readString();
    BTSerial.print(message);
  }
}

You can only have one software serial at a time.

I see, Im trying the AltSoftSerial library if it can solve this

Try.
If not, buy Esp32, it has 3 serial ports and bluetooth.

Are hardware serial ports suitable for multiple serial ports (Mega2560)?

https://docs.arduino.cc/built-in-examples/communication/MultiSerialMega/

I only have a UNO at the moment

Try this approach:
https://docs.arduino.cc/tutorials/communication/TwoPortReceive/
I have never tried, and I don't know if you can have different baud rates.

Good idea. 38400 is risky.

Both are now outputting the data from my phone to hc05 and the gps data, problem is they have slight difference in latitude and longitude which is understandable but then im having a hard time making it output arrived if they are close enough and going if they are far enough. I tried padding but then its still the same

what do you mean risky? i find it that setting the BTSerial of my HC05 allows me to send data from my phone to the HC05, I tried previously setting the HC05 UART to 9600, but then i wasnt able to send data via bluetooth terminal app

You could have grief communicating @ 34800 using software serial. This despite the fact that you are obliged to use that rate in AT mode. No comment as to why you had grief @ 9600, other than that the rates must match.