Cassandra 5.0 will only work with Java 11 and 17 (see What's New in 5.0 <https://cassandra.apache.org/doc/5.0/cassandra/new/index.html>). Java 21 is not planned until some future major release (we'll call it 6.0 for convenience) but never in a minor release so won't be in 5.whatever.
P.S. Ignore the 5.x Fix Version field in 18831. It's just a placeholder for tickets being worked on but not yet targeted. Cheers!