Tides are due to the change in the center of gravity on earth, there are three dominant things that must be looked at.
1. rotation of Earth
2. Earth orbit around the sun.
3. Moon's orbit around the earth.
This are the three major players.
They have an effect on the center of gravity on earth.
Drawing a straight lines from center to center of each object.
This involves the three body problem in orbital mechanics.
The common center of gravity of the moon and earth is some distance below the surface of Earth this is not a fixed location as the earth rotates the location stays in Direct line with the moon.
This point is the center of the orbit of the Moon, possibly the reason for the perturbation Earth moon orbits around the sun.
The oceans being liquid have the ability to move across the surface of the earth and would want to seek the center of gravity, hence creating the tides.
The suns distance from the earth, has a lesser effect, on the two bodies gravity Center but still has that influence on the tides.
You may say that the earth moon orbits each other, and that they orbit the sun, as a single gravitational object.
Getting off on a tangent I’ll quit.