A5 is the system protecting itself on pressure. In heating it means the high side has gone past its limit, usually because heat is not being moved away from the indoor coil. In cooling it is the opposite problem, with the indoor coil freezing over and the unit shutting down before the pipework ices up. Two directions, one code, which is why the mode matters before anything gets tested.
A filter that has not been cleaned in a year, or an indoor coil with a mat of dust across the fins, cuts the airflow that carries heat into and out of the coil. In heating that pushes discharge pressure up, in cooling it drops coil temperature until ice forms. Check the filter first, because it is free and it is the most common cause.
A system short of refrigerant runs colder at the indoor coil in cooling and freezes it, then runs hotter at the compressor in heating. The leak is usually slow, so the unit can work for a season before the code appears. Topping up without finding the leak only delays the next call-out.
The pressure transducer reports operating pressure back to the board. When it drifts, the unit either trips early or ignores a genuine pressure problem. A sensor fault looks exactly like a real pressure fault on the display, so the reading has to be checked against gauges before anyone orders a sensor.
An undersized outdoor unit working through a forty degree afternoon, or a coil asked to heat a room with the doors open, will hit its pressure limit legitimately. If A5 only appears on the hottest and coldest days of the year, the system is being asked to do more than it was sized for.
Pull the filters, wash and dry them, then inspect the indoor coil with a torch. A coil cleaned with the right chemical and properly rinsed is a different machine to one that has only been vacuumed. This alone clears a large share of A5 faults and should always come before testing gas pressures.
Measure airflow across the coil, then check operating pressures against the outdoor ambient. The two have to be read together, because a restricted coil and a low charge both show abnormal pressure, and only one of them needs refrigerant added.
If pressures read correct at the service ports while the board reports a trip, the transducer is the one that is lying. Confirm that before replacing it, and check the harness and plug while you are in there, since a corroded connection produces the same symptom for a fraction of the cost.
If the code only shows up on extreme days, the answer is not a part. Look at the unit capacity against the room load and how the space is actually used. That conversation is worth having before a fourth call-out for the same code in the same season.