Theory:
When values of the random variable xiξ, normally distributed with mathematical expectation muμ and standard deviation sigmaσ, are used to find an approximation for muμ, there is a dependency between sigmaσ and confidence interval of a radius Delta around mu, where the values of xi must be with certain probability, so we can say that
"With probability P the values of random variable xi will fall in an interval from mu - Delta to mu + Delta."
Given any required probability P, we can find confidence interval Delta if we know the standard deviation sigma.
Obviously, the higher required probability with a given standard deviation sigma - the wider confidence interval must be.
On the other hand, if probability P is fixed, the smaller standard deviation sigma is - the narrower confidence interval should be to satisfy the probability.
Radius of the confidence interval Delta is called a margin of error.
Example:
100 people measure the length of a car.
Their results X_1,X_2...X_100 can be interpreted as values of normally distributed random variable with mathematical expectation equaled to the real length of a car mu and some standard deviation sigma that depends on precision of the measuring instrument and accuracy of the people.
Let's approximate unknown mu as
mu ~= (X_1+X_2+...+X_100)/100
and approximate unknown sigma as
sigma = sqrt(((X_1-mu)^2+(X_2-mu)^2+...+(X_100-mu)^2)/100)
Knowing these approximate values and fundamental properties of the normal distribution, for a given probability P=0.95 we can derive that confidence interval should be within an interval from mu - 2sigma and mu + 2sigma, Radius of the confidence interval (that is a margin of error Delta) is 2sigma.
So, we can say that with probability 95% the car length is between mu - 2sigma and mu + 2sigma.
As you see, standard deviation and margin of error are functionally dependent.