The beer will hold a certain volume of CO2 depending on the temperature and the pressure. A colder kegerator will allow more CO2 to go into solution. Also, a higher pressure will cause more CO2 to go into solution.
This is a separate thing from the serving line.
However, the serving line can determine how much CO2 will REMAIN in solution during a pour. If you carb up a beer, and then drop the pressure (to what is commonly called "serving pressure", the beer will go from a relatively stable saturation, to a suddenly lower pressure during the pour, causing it to create bubbles and foam.
Keeping the regulator pressure constant, prevents the beer from coming out or solution during a pour (until it hits the warmer glass with substantially less pressure).
The line diameter and length determines the resistance the beer encounters as it leaves the keg, and can affect the foaming of a pour.
Also, the beer will slowly lose CO2 from solution if the temperature rises, or the pressure drops. It doesn't happen right away. It works just like when it takes time to carb up a keg.
Here is a
Chart that gives a temperature and pressure and line length calculation to determine the optimum of each. And remember that some beers are traditionally served at higher or lower carb levels than others. Check the style guides to know what the preferred carb level is and apply the chart accordingly.