Multiple URL rewrite rules and get every prams

See this is sort of solved in the comments and old but to save someone going down the wrong path here, I believe this is done the wrong way for OP to achieve what they want.

One re-write rule should be enough here, and then use the matches to construct your query.

Firstly, we need a Regex that will match the whole string of what you’re trying to parse

Something like this will work "/^messages\/(inbox|sent|draft|unread)\/?(\d*)?$/"
https://regex101.com/r/33F9Po/1

That starts with messages/ has any of (inbox|sent|draft|unread) in the middle, an optional slash and a second optional match group of numbers at the end.

This will allow your rewrite rule to work as follows using your $matches

add_rewrite_rule(
    '^messages\/(inbox|sent|draft|unread)\/?(\d*)?$',
    "index.php?pagename=messages&section=$matches[1]&id=$matches[2]",
    'top'
);

See this page in the codex for more information and examples
add_rewrite_rule() | Function | WordPress Developer Resources