Use dimensions to make a rule only apply in certain dimensions. Put it inside not to make it apply everywhere except those dimensions.
The vanilla dimensions are minecraft:overworld, minecraft:the_nether and minecraft:the_end.
No water buckets in the Nether
{"action": "remove","items": ["minecraft:water_bucket"],"dimensions": ["minecraft:the_nether"]}
Flint and steel only works in the Nether
{"action": "remove_interactions","items": ["minecraft:flint_and_steel"],"not": {"dimensions": ["minecraft:the_nether"]}}
Ender pearls only work in the End
{"action": "remove_interactions","items": ["minecraft:ender_pearl"],"not": {"dimensions": ["minecraft:the_end"]}}
No beds outside the Overworld
Beds can still be placed, but not slept in:
{"action": "remove_interactions","blocks": ["#minecraft:beds"],"not": {"dimensions": ["minecraft:overworld"]}}