When I want to share a post, I always first remove my user ID (the last number) from the link. Is this recommended or not? And why is my user ID there anyway?
Your user ID is there to keep track of how many users visit a link thanks to you sharing it; there is a series of badges for that, namely
You can of course remove that ID when you don't want to expose your Mathematics Stack Exchange account to whomever you share the link with, or in the rare case that it's too long (e.g. in a lengthy comment).