When performing a biopsy on an ulcer, it is recommended to take the sample from the margin of the ulcer, as this area contains both normal and abnormal tissue, providing more diagnostic information. The center of the ulcer may only contain necrotic tissue, which is less informative for diagnosis.