Check for block with Raycast

Minecraft Version: 1.20.2 No Mods or Plugins

I am attempting to check for the player looking at a block when they right-click with a custom "ritual powder" item.

This is what I'm currently using, however it's extremely inconsistent:

particle cloud ~ ~ ~ 0.1 0.1 0.1 0.05 3 force @a[tag=!global.ignore,tag=!global.ignore.gui,distance=..40]

execute anchored eyes positioned ^ ^ ^0.5 if block ~ ~ ~ campfire run function shamanism:blocks/bless_campfire

scoreboard players add @s SR.range 1

#raycast loop#
execute unless entity @s[scores={SR.range=4..}] if block ~ ~ ~ #shamanism:blockignore positioned ~ ~-0.9 ~ unless entity @e[distance=..0.75,type=!#shamanism:spiritraycastban,tag=!SR.spiritraycast] positioned ^ ^ ^0.9 positioned ~ ~0.9 ~ run function shamanism:use_item/ritual_powder_2
tag @s[scores={SR.range=4..}] remove SR.spiritraycast
scoreboard players set @s[scores={SR.range=4..}] SR.range 0```

This portion in particular:
```execute anchored eyes positioned ^ ^ ^0.5 if block ~ ~ ~ campfire run function shamanism:blocks/bless_campfire```

How could I consistently make the raycast recognize the Campfire block that the player is looking at?
Continue to help post