It's handles for you. You just run the task and it decides what is safe to remove. I've done it many time and it works well.
Edit: Actually, I have a little batch file I run for this called DISMandSFC.bat:
@echo off
date /t & time /t
echo Dism /Online /Cleanup-Image /StartComponentCleanup
Dism /Online /Cleanup-Image /StartComponentCleanup
echo …
date /t & time /t
echo Dism /Online /Cleanup-Image /RestoreHealth
Dism /Online /Cleanup-Image /RestoreHealth
echo …
date /t & time /t
echo SFC /scannow
SFC /scannow
date /t & time /t
If you want you can take the above lines and put them in a batch file then run from a Elevated Command prompt.