4XX HTTP Status Code - What is SEO Relation?
4XX code used to handle client-side errors that are different from server-side errors. It does not include any kind of redirect. From an SEO point of view, 404 pages become broken links that harm your SEO optimization.
Note: 404 pages only become broken links if you use it as an internal or external link.
So try to avoid any 404 pages to link.