Well, your chances increase the farther you go in.
Another thing that changes as you progress through further Light Years is the chance of encountering a Shiny Pokémon. The further you go, the higher the chance is that the Pokémon you will get is a Shiny Pokémon and the wormhole also factors in capping at 5,000 Light Years at 36% in the Type 4 Wormholes. However, there is a twist to this. The shininess of a Pokémon is determined when you land on the Ultra Space Wilds. As such, you will have the ability to soft reset the Shiny Pokémon to get a better nature or IVs should you do so desire.
Type four wormholes are the gaurenteed legendaries.
Also, you mentioned the shiny charm, which also works to help you find more. Regular shines will have increased chances as you go farther in, as I mentioned, but the shininess is set when you land for regular Pokemon, meaning you can't soft reset. All you can do is go farther in with a shiny charm and hope for the best. As for legendaries, yiu will want ones with large rings.
Type four wormholes have gaurenteed legendaries.
It is the one with many rings. They start appearing at 2500 lightyear with a 1% chance, and increase by 1% every 500 lightyears, and then topping at 5% at 4500 lightyears
Then, type 3 wormholes have a decent chance to find a legendary.
They look like this:
With 2 rings around it, they start appearing at 1000 lightyears, starting at 2%, increasing 2 4% at 1500 lightyears, than 8% at 2000. At 2500, it caps at 16%.
That's mostly it, but I will add that you have a very small chance of finding some in type 2 wormholes, which have one ring around them.
So, to summarize, the farther you go in, the better chances you have to find shies and legendaries. You can't soft reset regular Pokemon for shinies though. Go though the more fancy looking wormholes to increase your chances.