Sludge advice please

I have a e60 525d 2007 upon changing the valve cover gasket I was met with this sludge now I got the car in may 2021 and changed all fluids and it’s been running ok.

Is there anything I can do I’m hesitant on using engine flush.

As you can see in the pics it’s missed a few services.

Do you have mobil 1 high mileage oils there.
They also use esters for cleaning.
Might not be a bad idea to run M1 High Mileage oil about every 3rd oil change for extra cleaning during a normal OCI .
Ooph. That's meme material. 😁

I would not flush that engine. I believe in a sort of opposite approach with flushes and sludge. If it's that bad, I don't want to dislodge a bunch at once. Even a temporary partial blockage of a gallery could result in excess wear. I would do some short OCIs, changing when it got black, maybe in as little as 100-500 miles, with some cheap oil and something gentle like MMO or the Rislone mentioned, something that is meant to be left in the oil, not something that is designed to "run at idle and drain".

In my experience, like suggested, M1 HM is very good at cleaning but it is expensive and you need some short OCI's.
used mobil 1 high mileage 1 to short oci 1k to 3k ( get m1 high mileage extended performance on your for 3-4 oci few oci 5k less used Rislone high mileage or qr100 or mmo ) if do not want used additive get high performance oil cleaner which ester base oil .
That looks pretty bad, why not DMSO?

That looks pretty bad, why not DMSO?

Witnessed the results of this method. Extremely effective, but requires lots of precautions. No other product on the market is able to clean an engine up this quick. Literally an afternoon engine deep clean.
How hard is it to pull the oil pan? If not "too bad", pull it, clean it out as well as check oil pump screen for you know there has got to be sludge in / on it. Good Luck With That Mess!!!
Leave it alone. . Only safe way to remove the sludge is disassemble the engine. More frequent oil changes for a while is what I would do.