What is the best way for me to communicate to a partner that it’s not okay for them to interact with social media, etc when we’re being intimate and/or having sex?

In the vast majority of situations, the best way to communicate something to a partner is clearly, honestly, and in as non-accusatory a way as possible. Bring it up when you two are together but not in the middle of an intimate moment - just as a check-in and a request.

“Hey, the last few times we were snuggling in bed, you were on your phone - and that actually really bothers me. Could you please put the phone/computer/social media way while we’re having sexy or intimate time together?”

If they say “sure, I didn’t realize that was an issue, sorry!” then, great! If they do it again, a gentle reminder: “Can we agree no phones right now?”

This is a perfectly reasonable request for you to make - it doesn’t mean your partner has been doing something wrong since they didn’t know this bothers you, but once you let them know, it should be relatively easy to work through. It’s good practice to get into the habit of gently but openly having this kind of conversation in any relationship.

If, when you ask, they refuse, if they downplay it, insist that you shouldn’t be bothered, try to argue, etc. then they aren’t ready or willing to meet this need for you, and you need to decide whether this is a sustainable setup long-term for you.