In telecommunication systems, like full-duplex transceivers, simultaneous transmission, and reception demand highly linear components to minimize intermodulation interference. PIN-diode-based RF switches used either independently or as part of a device, can introduce nonlinearity in both on and off states. This article evaluates the impact of the topology on the linearity of PIN-diode-based RF switches and proposes an optimal two-diode arrangement to achieve superior linearity performance. The proposed topology combines the strengths of the series and parallel topologies while mitigating their weaknesses. Owing to its inclusion of two PIN diodes, the proposed topology also leverages the distance between them to further increase the linearity. The presented analysis indicates that having a quarter-wavelength distance between the diodes is key for achieving intermodulation cancellation in the on state, resulting in a 12 dB IIP3 enhancement. In the off state, complete distortion cancellation is more complicated due to additional reflections. The quarter wavelength transmission line was utilized as an impedance transformer to improve linearity by altering the impedance seen by each diode. Detailed analysis, supported by mathematical and experimental results, confirms a 20 dB improvement in IIP3 in the off state. Consequently, the peak IIP3 values, 99 dBm in the on state, and 111 dBm in the off state occur within a narrow bandwidth. The proposed switch maintains an IIP3 of 95 dBm in both states across a wider bandwidth of 1.8-2.6 GHz.