You can't pick any "abstract" object by UID.
What you can do is to add all sprites to a family. Then in your function you pick a family member by UID.
If you want your function to be even more universal and be able to process not just sprites, but also text objects, tiledbackgrounds etc, then you need to make several families, and your function can look like this:
On Function "ApplyEffectToAnyObject"
...SpriteFamily pick by unique ID = Function.Param(0) -> do something with picked SpriteFamily instance
...TextFamily pick by unique ID = Function.Param(0) -> do something with picked TextFamily instance