I don't really understand the difference between ActivityPub and Mastodon yet.
If I write my own ActivityPub software (server code with web frontend), can I interact with Mastodon users just as if I also were a Mastodon user? Or would I have to implement some Mastodon specific protocols?
Theoretically you should be able to follow anyone from pixelfed on Mastodon and vice versa because both support ActivityPub. I haven't tried doing that myself.
If I'm wrong I believe someone will correct me pretty fast but that's my current understanding.
If the popular solutions are too complex, maybe you want to take a look at https://microblog.pub, a relatively small and simple AP implementation designed for single-user instances.
That page also links to https://blog.joinmastodon.org/2018/06/how-to-implement-a-bas..., which is a demo of hardcoding one part of the spec from scratch.
So yes you can certainly interact with Mastodon users and you will need to.
https://www.r-bloggers.com/2022/10/getting-acquainted-with-m... the largest Mastodon instance has less than a million users. Twitter has, what, 450 million?