After you knockout Master Hand/Crazy Hand, wait for Master Beast to materialize a little while you're charging your fsmash. Fair is also a good way to damage it, as you can use both hits or SHFF first hit into shield if needed. Also, Master Beast's attack patterns are all stage based, meaning you can safely avoid damage by jumping off the stage and hang with a tether.
As for Master Blades, you can wait for it to materialize a little, before fully charging an usmash. Also you can Dair>Dair bounce>Uair/Fair before Blades is out of Link's ground hop range.
Also, bombs are good for safely damage on both Beast and Blades, and Gale Boomerang is also somewhat safe against Beast.
Learning the attack patterns of both Beast and Blades will greatly help your survivability.