You string concatenation is messed up, it should be: (further simplified)
$selDoc="SELECT * FROM documents WHERE 'U".$_SESSION['userId']."' IN (senderID,receiver_id) ORDER BY id DESC";
when the statement above is parsed, it will then look like this:
SELECT *
FROM documents
WHERE 'UXX' IN (senderID,receiver_id) // where XX is the userID
ORDER BY id DESC
As a sidenote, the query is vulnerable with SQL Injection
if the value(s) of the variables came from the outside. Please take a look at the article below to learn how to prevent from it. By using PreparedStatements
you can get rid of using single quotes around values.