Which equation to use for SHM?

Usually every simple harmonic question starts with the line: The block at equilibrium shifted to a position $X_0$ and released.

I found this from the website: https://study.com/academy/lesson/simple-harmonic-motion-shm-definition-formulas-examples.html

This equation has a sine in it, and a sine graph starts at zero. Using this equation is like starting your mathematical stopwatch in the middle of a pendulum swing: $t = 0$ is in the center of the oscillation. If, on the other hand, you replace sine with a cosine, then the equation is still correct; you're just starting to measure time at the maximum displacement instead.

Now if this holds true then most of my question in my textbook in which the mass is slightly displaced from an equilibrium point uses the $\sin$ equation instead of $\cos$. Aren't we measuring motion from the Amplitude point at $t=0$... Why the discrepancy?

For simple harmonic motion, the general solution is $$x = A\sin(\omega t + \phi)$$ where $A$ is the amplitude of oscillations, $\omega$ is the angular frequency (units radians per second) and $\phi$ is a phase shift. These quantities are defined by your system, and $\phi$ is determined by when you start your stopwatch. For example, if we say that I start my stopwatch when the block is at the equilibrium position, then $\phi=0$ and the solution is $$x = A\sin(\omega t)$$ If on the other hand we start our stopwatch when the block is at the amplitude, then the solution is $$x = A\cos(\omega t)$$ But this is exactly the same as setting $\phi=\frac{\pi}{2}$, so an equivalent solution is $$x = A\sin\left(\omega t + \frac{\pi}{2}\right)$$

Your textbook isn't adhering strictly, but the sine and cosine functions are mathematically equivalent in describing simple harmonic motion. This depends on when you start your stopwatch (which is $t = 0$). Sine is used when the object is at equilibrium when $t = 0$. Cosine is used when the object in at $x_0$ when $t = 0$. The questions are probably trying to say that the object is already displaced to $x_0$ and released when the stopwatch is started, which, strictly speaking, corresponds to a cosine. After all, the act of displacing the object isn't even simple harmonic. Both functions work just fine.

Also note that $$\sin x = \cos{ \left(\frac{\pi}{2} -x\right)} = \cos{ \left(x -\frac{\pi}{2}\right)}$$ $$\cos x = \sin{ \left(\frac{\pi}{2} -x\right)} = -\sin{ \left(x -\frac{\pi}{2}\right)}$$

A graph of displacement of the particle from its equilibrium position against time will be sinusoidal as shown below. The question (or you) will dictate where to start the timing $(t=0)$

In red the time starts when the particle is passing through the equilibrium position (displacement $= 0$) and it is moving in the positive direction.
In such a case use $y = A \sin \omega t$

In blue the time starts when the particle is at a maximum positive displacement from the equilibrium position and it is at rest.
In such a case use $y = A \cos \omega t$

In green the time starts when the particle has a maximum displacement in the negative direction and is not moving.
In such a case use $y = -A \cos \omega t$

In grey the time starts when the particle has zero displacement and is moving in the negative direction.
In such a case use $y = -A \sin\omega t$

So you will have to look at the problem at hand and decide which of the equations to use.