And testing for matches, you just use it twice and check “starts with”.
(It even works with the omitted :0000 form of CIDR for ipv6)
q: (((first (following text of first "/" of it as integer) of ((concatenation of (last 16 of padded string of (hexadecimal integer (it) as bits)) of substrings separated by ":" whose (exists hexadecimal integer (it)) of preceding text of first "/" of it) & "/" & following text of first "/" of it)) of ("2001:0DB9:AC10:FE01:0000:0000:0000:0000/64")),((first (following text of first "/" of it as integer) of ((concatenation of (last 16 of padded string of (hexadecimal integer (it) as bits)) of substrings separated by ":" whose (exists hexadecimal integer (it)) of preceding text of first "/" of it) & "/" & following text of first "/" of it)) of ("2001:0DB8/31";"2001:0DB8:/32"))) whose (item 0 of it starts with item 1 of it)
A: 0010000000000001000011011011100110101100000100001111111000000001, 0010000000000001000011011011100
Only the larger /31 subnet matches.
2001:0DB9:AC10:FE01:0000:0000:0000:0000/64
is a member of 2001:0DB8/31
2001:0DB9:AC10:FE01:0000:0000:0000:0000/64
is not a member of 2001:0DB8/32