You can use hardwareSerial to assign (ex)Serial1 and Serial2 to different pin's then use Serial1 and Serial2 to communicate with the GSM and GPS
HardwareSerial Serial1;
Serial1.begin(unsigned long baud, uint32_t config=SERIAL_8N1, int8_t rxPin=x, int8_t txPin=y, bool invert=false);
Just an ideea...