Be it a merchant or warship?
So, my answer is going to focus on the English navy of the late Middle Ages, particularly the navy of the Tudors.
It depended quite a bit on the ship and the amount of maintenance it got, but a service life of say 30 years wouldn't be unusual. One of the tricky things about answering this question is that it poses a ship of Theseus problem: to hide building costs from Parliament, the admiralty would sometimes ask for money for maintenance and use it to build entirely new ships, hiding what they were doing under the guise of a "great rebuild."
One of the better known ships of Henry VII's navy is the Henry Grace à Dieu (not to be confused with Henry V's Grace Dieu of 1418; that ship served most of its life moored in the Hamble until it was struck by lightning and burnt in 1439). The Henry Grace à Dieu was a carrack and one of the first ships to feature a true gundeck with gunports designed to allow guns mounted on a broadside. The ship was built at Woolwich in 1514 and rebuilt to lessen her top-hamper in 1536; she survived long enough to be present at the Battle of the Solent in 1545, when the Mary Rose sank, and was last mentioned around 1553.
The Henry Grace à Dieu was built at least partially as a response to the Scottish navy's Michael, the first ship designed in northern waters to carry very heavy guns. The historiography of the Michael is at least half myth (it's reported, for example, that it had oak "walls" 10 feet thick) but we do know that it was a white elephant, too costly to maintain, and sold to France within a couple of years after its completion (it was launched in 1511). It was left to rot in Brest and may have survived until 1545, but we don't know that for sure.
The Mary Rose is probably the best known Tudor ship, due to her sinking at the Solent and current status as a museum ship (about a third of the hull survived; she is no Vasa but there's only one of those). The Mary Rose was launched in 1511 and completed in 1512, and was rebuilt in 1536, at he same time as Henry Grace à Dieu (I should mention that in both cases, it's not clear what the rebuilding entailed). Her service life was obviously cut short by her sinking, but what's been recovered is in good shape considering the context.
/u/jschooltiger gave s better direct response, but I would like to point out that "dismantling" might not be the best term for the disposal of a ship once its sailing days were over. Quite often, they were stripped of their masts and equipment and then converted into hulks for storage of supplies (including hazardous items like coal an gunpowder in later years), quarters or even prisons. A ship is a huge capital investment and both navies and merchant ship owners will try to squeeze a few extra decades of use from a stripped, anchored hull if they can.
Adding to /u/jschooltiger/ 's answer, if we are to consider the age of discovery, there lifespans of ships could be quite varied. Kostam's "Sovereigns of the Sea" gives 5-10 years as the working life of the Dutch VOC vessels, often converted to war vessels during war. As opposed to French war vessels of that era that are built to last 1-2 decades.
The Dutch VOC ran its own shipyards, and they preferred to build very standardized ships at very low production costs and very fast turnover.