Not sure why people are making this subject so complicated by talking about the legality of earning cash-in-hand.
It is NOT illegal to earn cash-in-hand at all. If you are not an employee who is on the books (i.e get a wage slip) and you just get given cash at the end of your shift or end of the week then really you are considered self-employeed and it is up to you to pay/declare your earnings and pay the appropriate taxes and national insurance.
If you are claimig any means tested benefits, it is illegal to not declare your earnings.
If you are only earning a small amount from a cash-in-hand job the chances are you are probably earning less than your tax free yearly allowance. This means you won't have to pay any tax but you still need to declare it. Not sure if this is still the case but it used to be a £100 fine if you don't declare.
As a cash-in-hand/self-employed worker you will still need to pay your National Insurance contributions to keep your state pension entitlement. However, you do have the opportunity to pay off any missed periods at a later date.
I've always done some cash-in-hand work to top-up my earnings. Here are some of the cash-in-hand jobs I have done before: Commercial/domestic cleaning, Bar Work, Pot washing, glass collecting, Window cleaning, Dog walking, Take-away deliveries, car washing.