Use get_categories()!
OK, not that simple. It returns an array of WP_Term objects representing each category. You then need to loop through the result and echo out the name and term_id properties of each.
The other question is where to put this code? It ought to go on a theme template somewhere. But you likely do not want such a list on your usual site pages. I would put the code on a custom page template and make a private page based on the template. Copy your theme’s page.php, renaming it page-{$page_slug}.php. For example: if the page you create has the slug my-cats, the file name should be page-my-cats.php. Replace the call to the_content();
with your category code.
Keep a backup of your file, as it will be lost when your theme updates. To protect your changes from theme updates, create a child theme.
Like many things coding related, something simple can escalate into complicated. However, much of the complications in this case are setting you up to easily make other customizations in the future. Making custom templates and keeping them in a child theme will continue to serve you well.