custom 503 and 404 error page

how to link to the new html.twig that created by yourself?

I tried to add a controller.php to my theme and configured route.xml and services.xml, but it still can’t configure it properly.