What can cause you to cough phlegm with a little bit of blood?

Hemoptysis. Bronchitis/pneumonia/congestive heart failure/pulmonary embolus/ ling cancer with airway involvement to name a few. If symptoms persist, you should seek medical attention sooner rather than later.
Commonly, infection. Infection such as bronchitis, is the most common cause of blood tinged sputum. However, if this persist, other conditions such as tuberculosis, abscess, cancer, abnormal blood vessels, blood clots, fungal disease may be present. If it doesn't stop on its own, seek medical attention.