Could a wall dimmer switch be connected as part of the power cord for a table lamp (UK
There are two different options here. Including both, as the question was initially unclear, but question now refers specifically to the first option:
Installed as part of the power cord
There are two issues here - safety &amp; code compliance. I can't speak directly to code compliance in general on this, even more so for the UK. But as far as safety goes:
A regular wall dimmer switch is technically perfectly capable of handling a table lamp. Hot, neutral, ground go in &amp; out, some power runs the dimmer, the dimmer passes power on to the lamp. However, there are a few things to keep in mind:

As I think is indicated by &quot;UK 3 core wiring&quot;, you should make sure that you have hot, neutral and ground from the dimmer to the plug and from the dimmer to the lamp. In the US, table lamp cords often do not have ground. The dimmer switch may require ground, and if it does then you should make sure it is connected properly.

A dimmer switch (actually, any wall switch) is normally installed in a junction box. While it is quite likely that it is designed such that there are no exposed conductors, I would not consider it safe (and I am pretty sure it is not code compliant) to have a dimmer switch sitting &quot;open&quot; in the middle of a power cord. That would expose screw terminals and possibly some of the internal components of the timer to contact with pets, children and falling objects. The dimmer should be installed in a junction box, as if it were installed in the wall. The cords (one to a plug, one to the lamp) should exit the box with proper strain relief so that they can't be easily pulled out and mess up the connections to the dimmer.


Installed in the wall
There are two ways to use a dimmer switch in the wall for use with a light fixture:

Hardwired light fixture

This is the usual way. The dimmer controls one or more light fixtures which are permanently connected. The problem is that a table lamp normally plugs into an outlet. So to use it hardwired, you would have to essentially take the table lamp and permanently attach it to the house wiring. That seems a bit unusual and you would need to make sure the exposed wiring can't be accidentally tripped over, since it will not disconnect (at least not safely).

Control an outlet

Ordinary switches are often configured to control a wall outlet. It would be easy, technically speaking, to replace a regular switch controlling a wall outlet with a dimmer. However, dimmers are normally compatible only with lighting. If you connected a dimmer to an outlet and then plugged in another device (e.g., a toaster or a vacuum cleaner or a radio) you would get mixed results depending on the nature of the device (resistive load, motor or electronics), but in all cases (except lighting designed to be dimmer-compatible) the results would likely be less than ideal, and could in some cases even damage the device. Not recommended, unless you can clearly set aside an outlet EXCLUSIVELY for lighting.