If you find yourself in a position out on the golf course where the ball has landed so close to another object, such as a tree or a hedge and as a result your backswing is blocked, you will find it difficult, if not impossible, to move the club head away from the ball well and to generate any club head speed to connect with the ball and move it any distance forward.
Initially, look at the situation. Remember, you do not have to hit the ball towards the target. You need to hit a shot that makes your next shot easy so consider playing the ball sideways if this position gives you room to make a backswing.
You also have the option of turning the club over and playing left handed if the situation allows. Don’t be too greedy for distance when playing this shot. Ensure you get a good connection with the ball from the club face so only play to a maximum swing height to the waist to allow you to control the club head more easily.
Finally, remember you can always deem the ball unplayable and take a one shot penalty drop - either back where you last played from or within one club length, not nearer the hole, of the current ball position. What you do not want to do is play at the ball, mis-hit it and be left in a really similar position for the next shot, as your score will start to creep up. Keep the score down by making a good decision, take the drop and accept the one shot penalty, play a good next shot and build from there - a bogey on your card is not ideal but is recoverable and it is a lot better than a quadruple bogey, or worse!