Something like this:
public static void deleteGrid(int startX, int startY, int width = 5, int height = 4) 
{
    // to avoid Errors, Check if indexes are in bound for grid.
    // if condition code goes here
    // then...
    for (int i = startX; i < startX + width; i++)
    {
        for (int j = startY; j < startY + height; j++) 
        {
            Destroy(grid[i, j].gameObject);
            grid[i, j] = null;
        }
    }
    Score.currentScore += 1;
}
Call it like this:
Grid.deleteGrid(2,3); // default width = 5, height = 4 will be used here.
Or
Grid.deleteGrid(2,3,3,3); // this will delete 3X3 grid at index (2,3)
6
solved C# Tetris, clear the formed rectangle instead of row or line