Navigate to the server or the direct message with the user with the User ID you want to obtain. Long-press on the user's avatar (profile icon) to reveal the user's profile, then press on the three dots icon at the upper right corner of the profile. Select Copy ID.