Yes, you can do this quite easily with command blocks
You can use the /execute to detect for the block the player is on top of
Let's say on the inside of the 4x4 door, the player will be standing on iron blocks.
You can use the first command if you want the command block to directly do a task. You can use the 2nd command if you want the command block to send a redstone signal.
/execute as @p at @s if block ~ ~-1 ~ iron_block run <Your command here>
/execute as @p at @s if block ~ ~-1 ~ iron_block
Then place a redstone comparator around the command block then a repeater after that. When a player steps on an iron block, the redstone comparator will pickup a signal and send it to the repeater, now you can link that to whatever you want to do.
You could also use /execute to find certain coordinates the player might be at.
*Please set the command blocks to repeating and Always Active*