Most of these systems probably leverage an elevation dataset.
For example the USGS National Map offers a web service to query elevations based on latitude and longitude. It uses 3DEP which has 1/3 arc-second (~10 meter) resolution.
For apps that allow offline updating of elevation they probably use the SRTM1 or STRM3 elevation datasets which have 1 arc-second and 3 arc-second resolution respectively, but the datasets are small enough to be stored locally.
The discrepancy between most of those apps is a result of sample rate. If you calculate elevation change from one trackpoint to next across the whole set you will get a jagged line similar to what you see near 5km in your track. This jagged line, is most likely the result of error, but can produce a large amount of elevation gain to be measured.
This is where smoothing comes in. By smoothing the elevation profile you get a more realistic measurement of elevation gain. There are many techniques for applying smoothing to GPS track, everything from lowering the sample rate, to peak/valley detection, to Kalman filters. Depending on the approach the app uses the results will differ.
My guess is that looking at your results that Map My Ride uses a long (less frequent) sample rate where as Ride With GPS uses a short (more frequent) sample rate.
All that being said, I think going forward my money would be on Strava. Mostly because I don't have to speculate with them, and what their doing is well documented and I consider to be a smart approach. Knowing that barometric elevation data is currently one of the best abundant data sources for elevation, they are creating a Elevation Dataset based on barometric measurements. So if another runner/cycler using a device with a barometer had a reading near your location, they use that more accurate data.
In the case where they don't have barometric data available they use their legacy system, which leverages peak and valley detection, to smooth the elevation profile of your GPS track.