MSL is not a true altitude, it is a model of the atmosphere based on standard pressure lapse rates and temperatures. MSL is what an altimeter indicates when the barometric pressure is set in the Kollsman window to match the altimeter setting from a nearby location. Unfortunately, the atmosphere rarely cooperates. The barometric altimeter is primarily used for vertically separating aircraft. A wide margin is added to the altimeter for enroute IFR navigation to establish safe terrain and obstacle clearance, 1000 feet in non mountainous areas and 2000 feet in mountainous areas. In the US, above 18000 MSL, flight levels are used where all aircraft set the altimeter to 29.92. Flight levels are a pressure altitude. Pressure altitude is used in transponders and ADS-B Out systems because it does not depend on the pilot setting the correct altimeter setting and all aircraft are on the same footing. From the Altimeter test specifications in part 43, Appendix E, the scale error allowed for a compliant barometric altimeter is +/- 20 feet at 1000 feet, +/-80 feet at 10,000 feet, +/- 130 feet at 20,000 feet, and +/- 180 feet at 30,000 feet. The pressure adjustment in the Kollsman window allows the pressure setting to vary between 28.10 and 31.00 which represents a possible altitude adjustment from 29.92 of +924 feet to -1727 feet, or a total range of 2,701 feet. The typical barometric altimeter has no compensation for temperature, and depending on the height above the place where the barometric altimeter setting is established, the error is measured in hundreds or even thousands of feet. For the effect In extreme cases of high and low temperatures, see AIM 7−3−1. Effect of Cold Temperature on Barometric Altimeters. Only cold temperature errors are shown in degrees C, but temperatures warmer than standard have the same amount of error in the opposite direction. Remember that standard temperature at sea level is approximately 15 degrees C. So if you are comparing what your altimeter reads on a hot summer day, expect the GPS altitude to show you are much higher and on a cold winter day expect the GPS altitude to read much lower.
With GPS, altitudes and positions are determined by geometry based on height above a modeled surface. The most common surface model of the earth is WGS84 spheroid. The spheroid is a smooth shape and matches sea level to within +/- 400 feet around the globe. For all practical purposes, the error in a GPS height calculation with good geometry is independent of altitude, so if there is 25 feet of error at sea level, the error at 10,000 or 20,000 or 30,000 is going to be 25 feet. It is for this reason that terrain and obstacle databases are expressed in height above the WGS84 spheroid and not in terms of height above MSL. The same is true for WAAS based vertical guidance, that is the key heights are in terms of heights above the spheroid. When GPS altitude is displayed to the pilot, the height above the spheroid is adjusted via a geographic database (geoid) to height above sea level. This is a very accurate height within the tolerances of the GPS vertical accuracy. All current WAAS panel mount GPS systems are required by the TSO to display the lateral and vertical accuracy of the position and they do so on the Satellite page. HFOM (Horizontal Figure of Merit) is the horizontal accuracy and VFOM (Vertical Figure of Merit) is the vertical accuracy. On my GTN 750, I typically see a VFOM around 25 feet.