I base my following suggestions after fighting Taj at Apex, beating random mewtwos at SSS and sktar, and watching Jreed fight Emukiller at the same SSS.
To beat teleport. You must shffl nairs the MOMENT you see the teleport happen. You're going to tell me, "oh there's no way, it's too fast!" IT ISN'T. There's like a 7 frame window to tech. If you can react to that, you can react to teleport. M2's jumpsquat is 5 frames (though he might not teleport, you can at least anticipate it). M2's teleport is 23 frames PLUS the startup for nair 5 frames. You have over a half a second to react to that.
Why nair? Nair covers both behind and in front of you. You're not going to give M2 that luxury of crossing you up. Plus, if you hit with the weak hitbox of nair, by nairing ASAP, you can get a follow up off it! Aerials and grabs net the greatest reward. SB is also good if you can catch M2 right before he hits the ground.
Neutral. Stay exactly in teleport range. WOW! It sounds so counter intuitive but so many M2 players are conditioned to teleport in when given the opportunity. So much so that while you're weaving in and out, the idea to teleport repeatedly pops into their mind "I can teleport now and nail him". As you've learned from earlier, you can stuff teleport no biggie, so this will hurt the M2 a lot. BONUS. At this range, M2 isn't safe if he misses a shadow ball so he will be less likely to use it. If he does, you can just charge in with your dash grab or aerial/bite.
His next choice of action will likely be some sort of wd into a tilt. By staying in teleport range, you have plenty of leeway to keep out of that range and potentially punish. On successful shield, nair OoS was reliable enough for me. If you end up shielding one of those nairs, buffer a roll away if you have the stage space. M2 can punish if you roll behind him. If you don't roll, M2 will mix up with either a float fair or grab. You don't have an option that beats both. Sidestep beats grab and stay shielding beats fair. Pick at random I guess.
Avoid low platform stages. Avoid large stages. If you must pick a stage with platforms, pick one with the highest available platform instead of ones where M2 can utilt you. GHZ is a pretty good one. For some reason M2 can teleport from the ground into float on this stage so the teleport nairs are 5 frames faster. It's no big deal. You still have a ton of time to react. If the M2 player knows this, you may even be able to bait out more teleports - which you can punish! FD is good. DL64 is awful because M2 will never die. Most M2 players ban the small stages so you can't pick those. If they don't, pick them. YS and WW. The rate at which M2 dies will make up for the low platforms. Besides, it's not like there aren't high platforms on the stage also. PS2 favors M2 slightly due to low platforms and M2 can kill you off the top (uthrow) easier than you can (uair). BF and FoD are even. SV and FD favor you the best.
vs. Link
don't get grabbed.
bait and punish.
if you manage to get in due to a missed boomerang, choose your move so that the kb send Link up to avoid the boomerang on it's way back
dthrow dacus to uair juggles is excellent.
bair is a safe poke that nets you stage control and a great ko option
when you go in for those shffl aerials and you get shielded, don't always pull back. Link wants you there. Land behind him whenever possible. It may deter him from attempting a grab even though his buttcheeks can clamp down on you and cause you to appear in his hands. why.png
ledgedrop nair is best edgeguard.
create these opportunities by threatening SB if he attempts to recover high.
the best position to be in is the space where he's tempted to throw something at you but you're still close enough to jump over and fastfall aerial/bite. Then 50/50 between immediately attacking or dj somewhere to avoid utilt/usmash before you punish.
try getting gud at powershielding. even if you mess up the 1 frame reflect, brawl's easy 2 frame powershield will still keep your shield healthy to try again.
dacus and dash attack can close the gap real fast if Link is keeping you out a lot.
I mainly fight campy links so idk if my advice here will help vs. your link. That dude can do everything.