Date: 202105
Local time of day: 1801-2400
Location: ZZZ.Airport, US
Light: Daylight
Aircraft: Commercial Fixed Wing
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Taxi
ATC / advisory: Ground ZZZ
Second aircraft: Commercial Fixed Wing
Reporter organization: Air Carrier
Reporter function: First Officer; Pilot Not Flying
Reporter qualification: Flight Crew Multiengine; Flight Crew Air Transport Pilot (ATP)
Human factors: Time Pressure; Situational Awareness; Confusion
Second reporter function: Captain; Pilot Flying
Anomaly: ATC Issue All Types; Conflict Ground Conflict; Critical; Ground Incursion Taxiway
Detector: Person Flight Crew
When detected: Taxi
Result: Flight Crew Requested ATC Assistance / Clarification; Flight Crew Took Evasive Action
Contributing factors: Human Factors; Procedure
Primary problem: Human Factors

Narrative: Upon landing; we were advised by Ramp control that our gate was occupied and to have Ground Control hold us off of the gate.  Ground Control cleared us to taxi north on [taxiway] 1 from 2; make a u-turn in the pad; and then hold short of 3 on 4.  We did so and were the third aircraft in line.  A B737 was first and an E-175 was second.  After a while; the E-175 was cleared to his gate and made a hard right to get out of line and proceeded to his gate.  Because the Captain was on the radio with Operations and I was on the radio with Ramp Control; we did not immediately move away to close the gap left by the departing E-175.  Upon completion of our radio calls; the Captain dropped the parking brake and began slowly moving forward to close the gap between us and the B737 that was now the first aircraft in line.  I noticed Aircraft Y coming from my right at a higher than normal rate of speed but was initially convinced that he was cutting through the pad and would be turning south on taxiway 5 to form a second line of aircraft holding short of 3.Both the Captain and I realized at the same time that the Captain of Aircraft Y was trying to squeeze between us and the B737 ahead. The Captain hit the brakes hard enough to make the aircraft stutter to a stop. Had we not noticed Aircraft Y and the Captain of my aircraft not hit the brakes; it is possible that the left wingtip of Aircraft Y that was rapidly cutting in line might have come across our flight deck window.  We were both stunned.  No clearance had been given for that aircraft to squeeze between us and the aircraft ahead of us.  No heads up had been given on either the Ground Control frequency or the ramp frequency to alert us that he was going to try and squeeze in ahead of us.  In my over 20 years of flying for an airline; I have never before seen such a reckless move and it is the closest I have ever come to an aircraft accident. I have thought about this for the past 22 hours and cannot for the life of me think of anything that would cause a pilot to think that taxiing in this manner was safe; a good idea; or in the best interest of anything I know about the safe operation of an aircraft and the protection of the passengers in one's care. I cannot speak for the mindset of the Captain in Aircraft Y.  I cannot think of anything that would cause me to operate an aircraft in this manner and therefore have no idea what to suggest.


Second narrative: Our gate was occupied; so we were instructed to get in line on the taxiway behind a company aircraft. During this time; the line began to move and I taxied forward. Another company Aircraft Y approached at a fairly high taxi speed and cut in front of us. I was able to stop in time after realizing where they were planning to go. If I had not seen them; their wing would of hit the front of our aircraft. We had switched off ground frequency to get an update on our gate. I returned to the frequency and asked what that was. I believe Aircraft Y answered that there was no room at the end of the line (the reason for cutting in front of us). Later; I asked the Ground Controller  what their flight number was; and I was told 'Snitches get stitches'.  I asked the Controller if I heard them right and Controller responded that it was a joke. I responded that I didn't think it was funny; I took it as a threat; and asked for the Tower phone number. I believe Aircraft Y taxied in front of us not knowing with certainty that we would see them. They did something that could of potentially damaged aircraft or injured persons. I can't speak for the crew of flight Aircraft Y or why they thought that was good practice and safe to do.  As far as my crew; I don't believe there was anything we could of done to change the outcome.  As far as the Ground Controller; I believe by what Controller said; Controller saw what had happened and didn't intervene. This created the possibility of two aircraft colliding on the ground. Instead; I believe; Controller thought the best course of action was to make a joke out of the situation.


Synopsis: Air carrier flight crew taxiing reported they had to suddenly brake to avoid another taxiing air carrier.