I tried an online simulation of LCD connection with 74HC595 shift register and it worked fine but when I tried the real thing couldn't find any registers but 74HC165n so I was wondering what's the difference in the connection and if the 74HC165n would even work in the connection?
I never worked with registers before and everything I did is copied from this link :
The 74HC595 is commonly available online, for example here. If you are starting out in electronics then it is best to stick to a known working setup rather than try to substitute different parts unless the consequences are understood fully.
Yes, you can control a 16x2 or 20x4 with a 74HC595. It uses 3 GPIO pins from the Arduino as well as 74HC595, potentiometer and breadboard/pcb.
Life is much simpler with the I2C backpacks available on Ebay. They fit neatly on the 16x2. Only costs 2 I2C pins. If you already have some I2C devices, it costs NOTHING.
I made a 595 backpack with a small piece of protoboard. It works fine but will never be as convenient as the ready-made I2C backpack.
I used 595s to control LCDs for a while, but now the i2c backpacks are so cheap, that it is unlikely that you can build a circuit yourself for less
i.e. these days you can get a i2c backpack off ebay delivered to your door for USD $0.79 yes 79 cents.
And when combined with my hd44780 library, it can auto detect all the needed initialization parameters so you get a plug and play solution regardless of the i2c address or the pin mapping used on the backpack.
So unless it is for educational purposes, these days I'd pass on using a 595/shiftregister and use an i2c backpack instead.