Yes it matters. The top-level domain affects how search engines see and list your site and it will affect the amount of organic traffic you could/would get. Google.co.uk will give higher relevance to .co.uk, over the same site on .com. If both .co.uk and .com are available always register both, if it’s UK traffic you want, put the site under .co.uk and forward the .com.
Remember ‘keyword stuffing’ when registering your domain, every little helps…