Need help with "Tetris" or "Match 3" puzzle logic

So I’m stuck trying to figure out how to get Unity to tell when the right blocks are matching

Example:

I get 3 identical blocks in a row (one next to the other), how do I get Unity recognize that these blocks are aligned and it’s ok to destroy them (like Tetris or Match 3)

Collision, Tags, maybe?

I would setup a data layer (essentially a 2D array) and store the current “color” at each point (initially -1 for all locations). When a block/node snaps into a place, you can calculate a nodes position in the area by it’s physical location, then set that data layer’s grid accordingly.

For example, if my scene is 100x100 units, and my blocks are 10x10 squares, when a block is at 90,90 then that maps to dataGrid[9][9].

Each time a you record new data, you need to scan your data for a match 3 (guessing a recursive function that walks the data 1 node at time), or a full line of the same color for Tetris (probably a lot quicker/easier).