Yes, you can collect Social Security retirement or survivors benefits and work at the same time, but there are a few conditions.
If you are at your full retirement age or older, you can keep all of your Social Security benefits no matter how much money you earn from work. If you are younger than your full retirement age (calculated by the Social Security Administration and based on when you were born), then there is a limit to how much you can earn and still receive the full amount of your Social Security benefits.
Basically, if you are younger than full retirement age, then the Social Security Administration deducts $1 from your benefits for every $2 you earn above a certain amount. During the year you reach your full retirement age, the amount you can earn without penalty is higher and the deduction changes to $1 of benefits withheld for every $3 you earn above that amount. The threshold amounts change every year; check the figures for the current year on the Social Security website.
If your Social Security benefits are reduced or withheld because of money you earned after you started receiving benefits but before you reached your full retirement age, that money isn't gone forever. When you reach your full retirement age, the Social Security Administration will automatically increase your benefits to account for payments that were withheld due to those earlier earnings.
Different rules apply if you work outside the United States. If your plans include working abroad, contact the Social Security Administration to find out how that will affect your benefits.
For people at full retirement age, being able to work and collect Social Security with no loss of benefits is a relatively new thing. Social Security was created in 1935, but it was another 65 years before people at full retirement age could work and collect Social Security benefits at the same time. The change came when President Bill Clinton signed the Senior Citizens' Freedom to Work Act of 2000.
For more information about working and receiving Social Security benefits at the same time, see How Work Affects Your Benefits on the Social Security website.