Generally nowadays, mostly no one uses the DVD writer in a laptop because of Pen-drive (USB Hub) or 4G data connectivity available to download anything if it is really required.
The next thing is, it is rare that some laptop DVD writer might be affected or get damaged but mostly that doesn't happen and even older laptops have good DVD writers which hardly get damages.
Another thing is, DVD writer might be okay but its related driver may not be there or driver is affected, so can't run or use it properly. So, it is wise to check it whether the real issue is from DVD writer or its driver.
In case if it is damaged, you can buy either the new one from the brand's authorized sellers in local or buy the similar old / used one that has no issue at all. You can replace it easily without any issue, and it has just max two screws to replace it.
In case if it is an old MacBook or a different one (which hard to replace technically) then you have to replace it where you buy it. It may not cost much to do it.
One more option is, you can buy an external DVD writer for the same laptop to use it effectively even if the internal DVD writer has an issue.