If you were buying a 5-year-old car what would you be looking for?
Alongside it being the right car for you and its condition you can see, you would want to know how the car had been maintained a healthy-looking service history will not just give you the peace of mind the car has been maintained but will give you some insight into how the previous owner has treated the vehicle.
Also, a steady record of the mileage in the service history adds to its provenance.
So a 5-year-old car or any age car will always attract more money with a good service history than one that has none or patchy history.
So yes keeeping your car serviced and maintained will add value to when you sell it as the potential buyer will value it higher than another car with no service history.