See
for the documentation that distinguishes, in particular the boxed note. It says the two are used for different purposes, but doesn't say what those purposes are. You can get one session ID using the getsid(pid_t) function; getting the other requires using the "Security Framework" and is obtained via SessionGetInfo(). The latter function can't be used to get the session ID of a different process.
The basic question is which session ID should be collected. And does there need to be any clarifying documentation about this?