Most people recommend using post name for permalinks. If this advice sounds good, set your permalinks to post name, by selecting the Post name option. This is a great choice and may be best for most people.
However, I don’t do that. I do use postname, but also prefix it with the postid. In other words, I use a custom structure of /%post_id%/%postname%/
Go To Dashboard → Settings → Permalinks.
I like to set my permalinks to post_id/postname as shown below
I use a custom structure of /%post_id%/%postname%/ because it removes ambiguity and in my opinion, makes the day-to-day running of the site easier.
I don't know if it interferes with Google’s view of a URL for SEO purposes. I don’t believe so, as I haven't tested it, but you can come to your own conclusion.
Take the example of the Yoast website where I found a selection of blog posts with the following URLs:
The above URLs all use the postname to form a slug, which is then used in the URL. To visit the second page listed - the page about keyword strategy - you would have to type most of the following URL, https://yoast.com/what-is-a-keyword-strategy/, in order to ensure you ended up at the right page.
This is because the URL is very similar to other URLs on the site as shown in the list above. Unless you type practically the full URL in each case, WordPress would have no idea which page you wanted to visit due to each of the URLs listed, being largely similar.
However if the postid is included you can visit a page using only its id. So if the URL were
https://yoast.com/123/what-is-a-keyword-strategy/ - all you would have to type is https://yoast.com/123/ (assuming you set your site up to allow this.)
This helps when typing URLs, say, into mobile phones, or when communicating a URL over voice. It’s much easier to type or communicate
An added benefit is that you can change the slug used in your post URL at will, for SEO purposes (should you ever need to) without having to set up a redirect after each change.
To be clear -using the post id and the post name as I prefer to do, I am guessing, makes no practical difference to using only the post name. But please know I have not tested one method versus the other so I do not know.
However, for the reasons outlined above, I prefer the flexibility of the post id followed by the post name.
Certainly when Google lists a page whose permalink contains a post id in the search results, Google does not include the post id in the listing. This implies that Google is fully aware of post ids and so I am assuming, discounts them for SEO purposes. But I could be wrong.