What drives the price
Whether the service entrance, meter base, and grounding all need replacing alongside the panel; whether the utility has to disconnect and reconnect the drop; and permit and inspection fees.
Older homes with cloth or aluminum branch wiring often can't be fully modernized at the panel alone.
When you actually need it
Federal Pacific and Zinsco panels are known hazards and worth replacing regardless. Otherwise, upgrade when you're adding real load — EV charging, a heat pump, a shop, or an addition.
Before you sign
Licensed electrician only, permit pulled, inspection included. Ask for AFCI/GFCI breaker requirements to be spelled out — they add cost and are code in most jurisdictions.