How to use OnTriggerEnter with a condition

I try to make OnPipe game. When i press screen i want the pipe same wide the thing that it collides. Here is the code but it doesn’t work.

Heading

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;


public class MainHoopCntrl : MonoBehaviour
{
    private Touch touch;
    public float speed;
    Rigidbody rigid;
    void Start()
    {
        rigid = GetComponent<Rigidbody>();
    }
    private void Update()
    {
        rigid.AddForce(Vector3.up * speed);

        if (transform.position.y >= 35)
        {
            SceneManager.LoadScene("playMenü");
        }
        if(touch.phase==TouchPhase.Moved)
        {
            transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
        }
        if (Input.touchCount > 0)
        {
            touch = Input.GetTouch(0);
        }

    }

     public void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.CompareTag("cylinder1") &&Input.touchCount>0)
        {
            transform.localScale = new Vector3(1.96f, transform.localScale.y, transform.localScale.z);
        }
        else if(other.gameObject.CompareTag("cylinder2")&& Input.touchCount>0)
        {
            transform.localScale = new Vector3(1.39f, transform.localScale.y, transform.localScale.z);

        }
    }

when i touch and hold the screen I want the pipe’s size equal to other pipe that it touchs and when i release my hand it returns old size which is

transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);

@Capricornum