I have an Egyptian passport and I got a UK visa years back. I'm planning to replace my passport to correct the spelling of my family name (from Abdelmalk to Abdelmalek). Since the visa on my old passport has not expired, can I still use it without any problems or will the change affect the visa validity?
Yes. You don't have to transfer your visa to the new passport. You travel with both.
Gov.uk has the information on this, but the key point is:
You can still use your visa even if your passport’s expired, but you can choose to replace it with a biometric residence permit (BRP) if you’re in the UK.
You must replace your visa with a BRP if your name or personal details change.