I'm not sure when to use $\frac{1}{\sqrt{n}}$ and when to use $1.96\sqrt{\frac{p(1-p)}{n}}$.
Are they both used to calculate the confidence interval at 95% for a population proportion?
Here are two questions from my book.
In a survey in a large city, 170 households out of 250 owned a pet. Find the 95% confidence interval for the proportion of households in the city who own a pet.
From a random sample, 136 out of 400 people experience discomfort after receiving a vaccine. Construct a 95% confidence interval for the population proportion who might experience discomfort.
For each question do I use: $\hat{p}\pm\frac{1}{\sqrt{n}}$ or $\hat{p}\pm \sqrt{\frac{p(1-p)}{n}}$ ?
And why ?
Multiple errors here: Apparently you want a 95% CI for binomial success probability $p,$ using the number of successes $X$ observed in $n$ independent trials, giving $\hat p$ as an estimate of $p.$
Provided $n$ is large enough for the normal approximation to apply, and for $\hat p$ to be a reasonably good estimate of $p,$ an approximate 95% confidence interval for $p$ is
$$\hat p \pm 1.96\sqrt{\frac{\hat p(1-\hat p)}{n}}.$$
In case, $\hat p \approx 1/2,$ the factor $1.96\sqrt{\frac{\hat p(1-\hat p)}{n}}$ is very nearly $\frac{1}{\sqrt{n}}.$
My guess is that you are expected to use the displayed expression to work your problems.
Note: Considerable theoretical, computational, and simulation evidence has shown that an interval that works much better for sample sizes such as those in your problem is as follows: Use $\tilde p = \frac{X+2}{n+4}$ to estimate $p$ and use $\tilde n$ instead of $n$ in the formula above to obtain the 'Agresti-Coull' (or 'Plus Four') confidence interval:
$$\tilde p \pm 1.96\sqrt{\frac{\tilde p(1-\tilde p)}{\tilde n}}.$$
Ref: Brown, Cai & Dasgupta (2001).