tag @e[type=item,distance=..5,nbt={Item:{id:"minecraft:obsidian"}}] add NoKillTag
fill ~-2 ~ ~-2 ~2 ~3 ~2 minecraft:chest{Items:[{Slot:0b,id:"minecraft:bedrock",Count:1b}]} replace bedrock
fill ~-2 ~ ~-2 ~2 ~3 ~2 air destroy
fill ~ ~ ~ ~ ~-1 ~ air destroy
execute at @e[type=item,distance=..6,nbt={Item:{id:"minecraft:obsidian"}},tag=!NoKillTag] run setblock ~ ~ ~ obsidian
execute at @e[type=item,distance=..7,nbt={Item:{id:"minecraft:bedrock"}},tag=!NoKillTag] run setblock ~ ~ ~ bedrock
kill @e[type=item,distance=..6,nbt={Item:{id:"minecraft:obsidian"}},tag=!NoKillTag]
kill @e[type=item,distance=..7,nbt={Item:{id:"minecraft:bedrock"}},tag=!NoKillTag]

execute as @e[type=item,distance=..6,tag=!DespawnSoon,tag=!SaveItem] run data merge entity @s {Age:5400}
execute as @e[type=item,distance=..6,tag=!DespawnSoon] run tag @s add DespawnSoon