Role of Organic Counterion in Lead- and Tin-Based Two-Dimensional Semiconducting Iodide Perovskites and Application in Planar Solar Cells